gcc/testsuite/gcc.dg/tree-ssa/modref-dse-1.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2 -fdump-tree-dse1-details" } */ |
| 3 | volatile int *ptr; |
| 4 | struct a { |
| 5 | int a,b,c; |
| 6 | } a; |
| 7 | __attribute__((noinline)) |
| 8 | static int init (struct a*a) |
| 9 | { |
| 10 | a->a=0; |
| 11 | a->b=1; |
| 12 | } |
| 13 | __attribute__((noinline)) |
| 14 | static int use (struct a*a) |
| 15 | { |
| 16 | if (a->c != 3) |
| 17 | *ptr=5; |
| 18 | } |
| 19 | |
| 20 | void |
| 21 | main(void) |
| 22 | { |
| 23 | struct a a; |
| 24 | init (&a); |
| 25 | a.c=3; |
| 26 | use (&a); |
| 27 | } |
| 28 | /* { dg-final { scan-tree-dump "Deleted dead store: init" "dse1" } } */ |