gcc/testsuite/gcc.dg/tree-ssa/pr24117.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 3 | |
| 4 | void link_error (void); |
| 5 | |
| 6 | typedef struct { |
| 7 | int x; |
| 8 | int z; |
| 9 | } Foo_t; |
| 10 | |
| 11 | char *xm; |
| 12 | void bar(void); |
| 13 | |
| 14 | void foo(void) |
| 15 | { |
| 16 | Foo_t x; |
| 17 | x.x = 1; |
| 18 | x.z = 2; |
| 19 | xm = (char *)&x; |
| 20 | bar(); |
| 21 | /* We can't propagate x.z past bar, so this link_error should still be there. */ |
| 22 | if (x.z != 2) |
| 23 | link_error (); |
| 24 | } |
| 25 | /* { dg-final { scan-tree-dump-times "link_error" 1 "optimized"} } */ |