gcc/testsuite/gcc.dg/pr101223.c
raw| 1 | /* PR tree-optimization/101223 */ |
| 2 | /* { dg-do run } */ |
| 3 | /* { dg-options "-O2 " } */ |
| 4 | |
| 5 | struct { |
| 6 | int a : 1; |
| 7 | } b; |
| 8 | int c = 1, d; |
| 9 | int foo1() { |
| 10 | for (; d < 2; d++) { |
| 11 | int e = ~c, f = 0, g; |
| 12 | if (e) { |
| 13 | f = c; |
| 14 | g = b.a; |
| 15 | b.a = f; |
| 16 | if (b.a >= g) |
| 17 | __builtin_abort(); |
| 18 | } |
| 19 | c = f; |
| 20 | b.a = g; |
| 21 | } |
| 22 | return 0; |
| 23 | } |
| 24 | |
| 25 | int foo2() { |
| 26 | for (; d < 2; d++) { |
| 27 | int e = ~c, f = 0, g; |
| 28 | if (e) { |
| 29 | f = c; |
| 30 | g = b.a; |
| 31 | b.a = f; |
| 32 | if (g <= b.a) |
| 33 | __builtin_abort(); |
| 34 | } |
| 35 | c = f; |
| 36 | b.a = g; |
| 37 | } |
| 38 | return 0; |
| 39 | } |
| 40 | int main () |
| 41 | { |
| 42 | return foo1() + foo2(); |
| 43 | } |
| 44 |