gcc/testsuite/gcc.c-torture/execute/pr45695.c
raw| 1 | /* PR rtl-optimization/45695 */ |
| 2 | |
| 3 | extern void abort (void); |
| 4 | |
| 5 | __attribute__((noinline)) void |
| 6 | g (int x) |
| 7 | { |
| 8 | asm volatile ("" : "+r" (x)); |
| 9 | } |
| 10 | |
| 11 | __attribute__((noinline)) int |
| 12 | f (int a, int b, int d) |
| 13 | { |
| 14 | int r = -1; |
| 15 | b += d; |
| 16 | if (d == a) |
| 17 | r = b - d; |
| 18 | g (b); |
| 19 | return r; |
| 20 | } |
| 21 | |
| 22 | int |
| 23 | main (void) |
| 24 | { |
| 25 | int l; |
| 26 | asm ("" : "=r" (l) : "0" (0)); |
| 27 | if (f (l + 0, l + 1, l + 4) != -1) |
| 28 | abort (); |
| 29 | if (f (l + 4, l + 1, l + 4) != 1) |
| 30 | abort (); |
| 31 | return 0; |
| 32 | } |