gcc/testsuite/gcc.c-torture/execute/pr40657.c
raw| 1 | /* Verify that that Thumb-1 epilogue size optimization does not clobber the |
| 2 | return value. */ |
| 3 | |
| 4 | void abort (void); |
| 5 | void exit (int); |
| 6 | |
| 7 | long long v = 0x123456789abc; |
| 8 | |
| 9 | __attribute__((noinline)) void bar (int *x) |
| 10 | { |
| 11 | asm volatile ("" : "=m" (x) ::); |
| 12 | } |
| 13 | |
| 14 | __attribute__((noinline)) long long foo() |
| 15 | { |
| 16 | int x; |
| 17 | bar(&x); |
| 18 | return v; |
| 19 | } |
| 20 | |
| 21 | int main () |
| 22 | { |
| 23 | if (foo () != v) |
| 24 | abort (); |
| 25 | exit (0); |
| 26 | } |