gcc/testsuite/gcc.c-torture/execute/pr24141.c
raw| 1 | // reduced testcase, compile with -O2. Also, with --disable-checking |
| 2 | // gcc produces wrong code. |
| 3 | |
| 4 | void abort (void); |
| 5 | int i; |
| 6 | |
| 7 | void g (void) |
| 8 | { |
| 9 | i = 1; |
| 10 | } |
| 11 | |
| 12 | void f (int a, int b) |
| 13 | { |
| 14 | int c = 0; |
| 15 | if (a == 0) |
| 16 | c = 1; |
| 17 | if (c) |
| 18 | return; |
| 19 | if (c == 1) |
| 20 | c = 0; |
| 21 | if (b == 0) |
| 22 | c = 1; |
| 23 | if (c) |
| 24 | g (); |
| 25 | } |
| 26 | |
| 27 | int main (void) |
| 28 | { |
| 29 | f (1, 0); |
| 30 | if (i != 1) |
| 31 | abort (); |
| 32 | return 0; |
| 33 | } |