gcc/testsuite/gcc.c-torture/execute/pr7284-1.c
raw| 1 | /* Signed left-shift is implementation-defined in C89 (and see |
| 2 | DR#081), not undefined. Bug 7284 from Al Grant (AlGrant at |
| 3 | myrealbox.com). */ |
| 4 | |
| 5 | /* { dg-require-effective-target int32plus } */ |
| 6 | /* { dg-options "-std=c89" } */ |
| 7 | |
| 8 | extern void abort (void); |
| 9 | extern void exit (int); |
| 10 | |
| 11 | int |
| 12 | f (int n) |
| 13 | { |
| 14 | return (n << 24) / (1 << 23); |
| 15 | } |
| 16 | |
| 17 | volatile int x = 128; |
| 18 | |
| 19 | int |
| 20 | main (void) |
| 21 | { |
| 22 | if (f(x) != -256) |
| 23 | abort (); |
| 24 | exit (0); |
| 25 | } |