view gcc/testsuite/g++.dg/warn/Wsequence-point-pr18050.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* PR 18050 : bogus warning with -Wsequence-point */
/* { dg-do compile } */
/* { dg-options "-Wsequence-point" } */

struct x
{
  int i;
};
void bar(struct x*, int *);

void foo(struct x *y)
{
  bar(y++, &y->i); /* { dg-warning "operation on 'y' may be undefined" } */
}

void zz(int a, int *b)
{
  *b = a;
}

void baz(void) {
  int a = 5;
  zz(++a, &a);  /* { dg-bogus "operation on 'a' may be undefined" } */
}