gcc/testsuite/gcc.c-torture/execute/20090711-1.c
raw| 1 | /* Used to be miscompiled at -O0 due to incorrect choice of sign extension |
| 2 | vs. zero extension. __attribute__ ((noinline)) added to try to make it |
| 3 | fail at higher optimization levels too. */ |
| 4 | |
| 5 | extern void abort (void); |
| 6 | |
| 7 | long long __attribute__ ((noinline)) |
| 8 | div (long long val) |
| 9 | { |
| 10 | return val / 32768; |
| 11 | } |
| 12 | |
| 13 | int main (void) |
| 14 | { |
| 15 | long long d1 = -990000000; |
| 16 | long long d2 = div(d1); |
| 17 | if (d2 != -30212) |
| 18 | abort (); |
| 19 | return 0; |
| 20 | } |
| 21 |