| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2" } */ |
| 3 |
|
| 4 |
/* Ensure that BIT_FIELD_REFs gets the appropriate VUSE. |
| 5 |
Contributed by Paolo Bonzini <[email protected]>. |
| 6 |
|
| 7 |
This testcase actually never triggered in the CVS repo, but it did |
| 8 |
in my local tree and it seems worth testing. In this test, the if's |
| 9 |
are folded to BIT_FIELD_REFs but the VUSEs were erroneously left out. |
| 10 |
Therefore, DOM did not see that i was modified between the two ifs |
| 11 |
and optimized away the second if. */ |
| 12 |
|
| 13 |
extern void abort (void); |
| 14 |
extern void exit (int); |
| 15 |
|
| 16 |
struct x |
| 17 |
{ |
| 18 |
unsigned b:1; |
| 19 |
unsigned c:1; |
| 20 |
}; |
| 21 |
|
| 22 |
struct x i = { 1, 1 }; |
| 23 |
|
| 24 |
int |
| 25 |
main () |
| 26 |
{ |
| 27 |
i.b = 1; |
| 28 |
if (i.b == 1 && i.c == 0) |
| 29 |
exit (0); |
| 30 |
i.c = 0; |
| 31 |
if (i.b == 1 && i.c == 0) |
| 32 |
exit (0); |
| 33 |
abort (); |
| 34 |
} |