1 |
689 |
jeremybenn |
/* PR 17880 */
|
2 |
|
|
/* { dg-do compile } */
|
3 |
|
|
/* { dg-options "-Wsequence-point" } */
|
4 |
|
|
|
5 |
|
|
int
|
6 |
|
|
foo (int x)
|
7 |
|
|
{
|
8 |
|
|
unsigned int a;
|
9 |
|
|
int b;
|
10 |
|
|
|
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" } */
|
19 |
|
|
|
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" } */
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
void bar (int i)
|
41 |
|
|
{
|
42 |
|
|
int a = i++ - i++; /* { dg-warning "undefined" "sequence point warning" } */
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
void baz (int i)
|
46 |
|
|
{
|
47 |
|
|
switch (i++ + i++) /* { dg-warning "undefined" "sequence point warning" } */
|
48 |
|
|
{
|
49 |
|
|
case 1:
|
50 |
|
|
i++ - i++; /* { dg-warning "undefined" "sequence point warning" } */
|
51 |
|
|
case 2:
|
52 |
|
|
break;
|
53 |
|
|
}
|
54 |
|
|
}
|