2014-04-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / sequence-pt-pr17880.c
blobdf706e577fb5ad50691e3327aa0a743d370b3d07
1 /* PR 17880 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wsequence-point" } */
5 int
6 foo (int x)
8 unsigned int a;
9 int b;
11 b = (a += 5) > a; /* { dg-warning "undefined" "sequence point warning" } */
12 b = (a += 5) + a == 10; /* { dg-warning "undefined" "sequence point warning" } */
13 b = (a -= 5) > a; /* { dg-warning "undefined" "sequence point warning" } */
14 b = (a -= 5) + a == 10; /* { dg-warning "undefined" "sequence point warning" } */
15 b = a-- > a; /* { dg-warning "undefined" "sequence point warning" } */
16 b = a-- + a == 10; /* { dg-warning "undefined" "sequence point warning" } */
17 b = ++a > a; /* { dg-warning "undefined" "sequence point warning" } */
18 b = ++a + a == 10; /* { dg-warning "undefined" "sequence point warning" } */
20 if ((a += 5) > a) return -1; /* { dg-warning "undefined" "sequence point warning" } */
21 if ((a += 5) + a == 10) return -1; /* { dg-warning "undefined" "sequence point warning" } */
22 if ((a -= 5) > a) return -1; /* { dg-warning "undefined" "sequence point warning" } */
23 if ((a -= 5) + a == 10) return -1; /* { dg-warning "undefined" "sequence point warning" } */
24 if (a-- > a) return -1; /* { dg-warning "undefined" "sequence point warning" } */
25 if (a-- + a == 10) return -1; /* { dg-warning "undefined" "sequence point warning" } */
26 if (++a > a) return -1; /* { dg-warning "undefined" "sequence point warning" } */
27 if (++a + a == 10) return -1; /* { dg-warning "undefined" "sequence point warning" } */
28 do {} while ((a += 5) > a); /* { dg-warning "undefined" "sequence point warning" } */
29 while ((a += 5) > a); /* { dg-warning "undefined" "sequence point warning" } */
30 for ((a += 5) > a;;); /* { dg-warning "undefined" "sequence point warning" } */
31 for (b = (a += 5) > a;;); /* { dg-warning "undefined" "sequence point warning" } */
32 for (; (a += 5) > a;); /* { dg-warning "undefined" "sequence point warning" } */
33 for (;; b = (a += 5) > a); /* { dg-warning "undefined" "sequence point warning" } */
34 for (;; a++ + a++); /* { dg-warning "undefined" "sequence point warning" } */
35 if (a) a++ - a--; /* { dg-warning "undefined" "sequence point warning" } */
36 ((a +=5) > a) ? a : b; /* { dg-warning "undefined" "sequence point warning" } */
37 return (a++ - a--); /* { dg-warning "undefined" "sequence point warning" } */
40 void bar (int i)
42 int a = i++ - i++; /* { dg-warning "undefined" "sequence point warning" } */
45 void baz (int i)
47 switch (i++ + i++) /* { dg-warning "undefined" "sequence point warning" } */
49 case 1:
50 i++ - i++; /* { dg-warning "undefined" "sequence point warning" } */
51 case 2:
52 break;