gcc/testsuite/gcc.dg/pr41033.c
raw| 1 | /* PR rtl-optimization/41033 */ |
| 2 | /* { dg-do run } */ |
| 3 | /* { dg-options "-O1 -fno-strict-aliasing" } */ |
| 4 | |
| 5 | struct X { |
| 6 | int i; |
| 7 | int j; |
| 8 | }; |
| 9 | |
| 10 | int foo(struct X *p, struct X *q) |
| 11 | { |
| 12 | p->j = 1; |
| 13 | q->i = 0; |
| 14 | return p->j; |
| 15 | } |
| 16 | |
| 17 | extern void abort (void); |
| 18 | |
| 19 | int main() |
| 20 | { |
| 21 | struct X x; |
| 22 | if (foo (&x, (struct X *)&x.j) != 0) |
| 23 | abort (); |
| 24 | return 0; |
| 25 | } |