diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/torture/c99-contract-1.c')
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/torture/c99-contract-1.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/c99-contract-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/c99-contract-1.c new file mode 100644 index 000000000..602308308 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/c99-contract-1.c @@ -0,0 +1,21 @@ +/* Test floating-point contraction occurs only within source language + expressions. */ +/* { dg-do run } */ +/* { dg-options "-std=c99 -pedantic-errors" } */ + +extern void abort (void); +extern void exit (int); + +volatile float a = 1 + 0x1p-23f, b = 1 - 0x1p-23f, c = -1; + +int +main (void) +{ + float av = a, bv = b, cv = c; + float p = av * bv; + float r = p + cv; + if (r == 0) + exit (0); + else + abort (); +} |