diff options
author | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
commit | 1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch) | |
tree | c607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gcc.dg/c11-complex-1.c | |
parent | 283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff) | |
download | toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2 toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip |
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/c11-complex-1.c')
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/c11-complex-1.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/c11-complex-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/c11-complex-1.c new file mode 100644 index 000000000..4acb2bcc2 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/c11-complex-1.c @@ -0,0 +1,43 @@ +/* Test complex divide does not have the bug identified in N1496. */ +/* { dg-do run } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ +/* { dg-add-options ieee } */ + +extern void abort (void); +extern void exit (int); + +#define CMPLX(x, y) __builtin_complex ((double) (x), (double) (y)) +#define CMPLXF(x, y) __builtin_complex ((float) (x), (float) (y)) +#define CMPLXL(x, y) __builtin_complex ((long double) (x), (long double) (y)) +#define NAN __builtin_nanf ("") +#define isnan(x) __builtin_isnan (x) + +volatile _Complex float num_f = CMPLXF (1, 1); +volatile _Complex float den_f = CMPLXF (0, NAN); +volatile _Complex float res_f, cres_f = CMPLXF (1, 1) / CMPLXF (0, NAN); + +volatile _Complex double num_d = CMPLX (1, 1); +volatile _Complex double den_d = CMPLX (0, NAN); +volatile _Complex double res_d, cres_d = CMPLX (1, 1) / CMPLX (0, NAN); + +volatile _Complex long double num_ld = CMPLXL (1, 1); +volatile _Complex long double den_ld = CMPLXL (0, NAN); +volatile _Complex long double res_ld, cres_ld = CMPLXL (1, 1) / CMPLXL (0, NAN); + +int +main (void) +{ + res_f = num_f / den_f; + if (!isnan (__real__ res_f) || !isnan (__imag__ res_f) + || !isnan (__real__ cres_f) || !isnan (__imag__ cres_f)) + abort (); + res_d = num_d / den_d; + if (!isnan (__real__ res_d) || !isnan (__imag__ res_d) + || !isnan (__real__ cres_d) || !isnan (__imag__ cres_d)) + abort (); + res_ld = num_ld / den_ld; + if (!isnan (__real__ res_ld) || !isnan (__imag__ res_ld) + || !isnan (__real__ cres_ld) || !isnan (__imag__ cres_ld)) + abort (); + exit (0); +} |