diff options
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/pr7284-1.c')
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr7284-1.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr7284-1.c b/gcc/testsuite/gcc.c-torture/execute/pr7284-1.c new file mode 100644 index 000000000..de0057ceb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr7284-1.c @@ -0,0 +1,24 @@ +/* Signed left-shift is implementation-defined in C89 (and see + DR#081), not undefined. Bug 7284 from Al Grant (AlGrant at + myrealbox.com). */ + +/* { dg-options "-std=c89" } */ + +extern void abort (void); +extern void exit (int); + +int +f (int n) +{ + return (n << 24) / (1 << 23); +} + +volatile int x = 128; + +int +main (void) +{ + if (f(x) != -256) + abort (); + exit (0); +} |