gcc/testsuite/gcc.dg/tree-ssa/pr47392.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-O2 -fno-code-hoisting -fdump-tree-pre-stats" } */ |
| 3 | |
| 4 | struct A |
| 5 | { |
| 6 | int i; |
| 7 | }; |
| 8 | |
| 9 | struct B |
| 10 | { |
| 11 | struct A a[2]; |
| 12 | }; |
| 13 | |
| 14 | int i = 1; |
| 15 | struct B b = { 0, 3 }; |
| 16 | |
| 17 | void |
| 18 | test () |
| 19 | { |
| 20 | if (b.a[0].i != i) |
| 21 | { |
| 22 | int t = b.a[0].i; |
| 23 | b.a[0] = b.a[1]; |
| 24 | b.a[1].i = t; |
| 25 | } |
| 26 | |
| 27 | if (b.a[1].i == i) |
| 28 | __builtin_abort (); |
| 29 | |
| 30 | if (b.a[0].i == 0) |
| 31 | __builtin_abort (); |
| 32 | } |
| 33 | |
| 34 | int |
| 35 | main () |
| 36 | { |
| 37 | test (); |
| 38 | return 0; |
| 39 | } |
| 40 | |
| 41 | /* { dg-final { scan-tree-dump "Eliminated: 1" "pre" } } */ |