gcc/testsuite/gcc.dg/ipa/modref-4.c
raw| 1 | /* { dg-options "-O" } */ |
| 2 | /* { dg-do run } */ |
| 3 | |
| 4 | static __attribute__((noipa)) int foo (void) |
| 5 | { |
| 6 | return 1; |
| 7 | } |
| 8 | |
| 9 | int main (void) |
| 10 | { |
| 11 | struct S { int a; int b; }; |
| 12 | struct T { struct S s; }; |
| 13 | |
| 14 | struct T t = { { 0, 0 } }; |
| 15 | struct T u; |
| 16 | |
| 17 | __attribute__((noinline)) void bar (void) |
| 18 | { |
| 19 | if (foo ()) |
| 20 | { |
| 21 | u = t; |
| 22 | /* OK with u.s.a = 0; */ |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | u.s.a = 1; |
| 27 | |
| 28 | bar (); |
| 29 | |
| 30 | if (u.s.a != 0) |
| 31 | __builtin_abort (); |
| 32 | |
| 33 | return 0; |
| 34 | } |