From 925a448751fd6d7988db51070b585e4fd55766a2 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Thu, 19 May 2005 09:05:45 +0200 Subject: re PR target/19933 (Problem with define of HUGE_VAL in math_c99.) fixincludes/ PR target/19933 PR target/21315 * inclhack.def: New fixes solaris_math_[1-9]. * fixincl.x: Regenerate. * tests/base/iso/math_c99.h: New. gcc/testsuite/ * gcc.dg/c99-math.h: New * gcc.dg/c99-math-float-1.c: New test. * gcc.dg/c99-math-double-1.c: Likewise. * gcc.dg/c99-math-long-double-1.c: Likewise. Co-Authored-By: Joseph Myers From-SVN: r99953 --- gcc/testsuite/ChangeLog | 7 ++ gcc/testsuite/gcc.dg/c99-math-double-1.c | 18 +++++ gcc/testsuite/gcc.dg/c99-math-float-1.c | 18 +++++ gcc/testsuite/gcc.dg/c99-math-long-double-1.c | 18 +++++ gcc/testsuite/gcc.dg/c99-math.h | 111 ++++++++++++++++++++++++++ 5 files changed, 172 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/c99-math-double-1.c create mode 100644 gcc/testsuite/gcc.dg/c99-math-float-1.c create mode 100644 gcc/testsuite/gcc.dg/c99-math-long-double-1.c create mode 100644 gcc/testsuite/gcc.dg/c99-math.h (limited to 'gcc') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fbb7b5f..7b1f427 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2005-05-19 Eric Botcazou + + * gcc.dg/c99-math.h: New + * gcc.dg/c99-math-float-1.c: New test. + * gcc.dg/c99-math-double-1.c: Likewise. + * gcc.dg/c99-math-long-double-1.c: Likewise. + 2005-05-18 Richard Henderson * gcc.dg/tree-ssa/20031015-1.c: Expect one V_MUST_DEF. diff --git a/gcc/testsuite/gcc.dg/c99-math-double-1.c b/gcc/testsuite/gcc.dg/c99-math-double-1.c new file mode 100644 index 0000000..227b6e2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-math-double-1.c @@ -0,0 +1,18 @@ +/* { dg-do run { target *-*-solaris2.1[0-9]* } } */ +/* { dg-options "-std=c99 -O" } */ + +#include +#include "c99-math.h" + +int main(void) +{ + double nan = NAN; + double inf = INFINITY; + double huge = HUGE_VAL; + double norm = __DBL_MIN__; + double zero = 0.0; + + C99_MATH_TESTS (nan, inf, huge, norm, zero) + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/c99-math-float-1.c b/gcc/testsuite/gcc.dg/c99-math-float-1.c new file mode 100644 index 0000000..9dd4e9a --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-math-float-1.c @@ -0,0 +1,18 @@ +/* { dg-do run { target *-*-solaris2.1[0-9]* } } */ +/* { dg-options "-std=c99 -O" } */ + +#include +#include "c99-math.h" + +int main(void) +{ + float nan = NAN; + float inf = INFINITY; + float huge = HUGE_VALF; + float norm = __FLT_MIN__; + float zero = 0.0f; + + C99_MATH_TESTS (nan, inf, huge, norm, zero) + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/c99-math-long-double-1.c b/gcc/testsuite/gcc.dg/c99-math-long-double-1.c new file mode 100644 index 0000000..43d1588 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-math-long-double-1.c @@ -0,0 +1,18 @@ +/* { dg-do run { target *-*-solaris2.1[0-9]* } } */ +/* { dg-options "-std=c99 -O" } */ + +#include +#include "c99-math.h" + +int main(void) +{ + long double nan = NAN; + long double inf = INFINITY; + long double huge = HUGE_VALL; + long double norm = __LDBL_MIN__; + long double zero = 0.0l; + + C99_MATH_TESTS (nan, inf, huge, norm, zero) + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/c99-math.h b/gcc/testsuite/gcc.dg/c99-math.h new file mode 100644 index 0000000..a1e217c --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-math.h @@ -0,0 +1,111 @@ +#include + +extern void abort(void); + +#define C99_MATH_TESTS(nan, inf, huge, norm, zero) \ +{ \ + if (fpclassify (nan) != FP_NAN) \ + abort (); \ + \ + if (fpclassify (inf) != FP_INFINITE) \ + abort (); \ + \ + if (fpclassify (huge) != FP_INFINITE) \ + abort (); \ + \ + if (fpclassify (norm) != FP_NORMAL) \ + abort (); \ + \ + if (fpclassify (zero) != FP_ZERO) \ + abort (); \ + \ + \ + if (!isnan (nan)) \ + abort (); \ + \ + if (isnan (inf)) \ + abort (); \ + \ + if (isnan (huge)) \ + abort (); \ + \ + if (isnan (norm)) \ + abort (); \ + \ + if (isnan (zero)) \ + abort (); \ + \ + \ + if (isinf (nan)) \ + abort (); \ + \ + if (!isinf (inf)) \ + abort (); \ + \ + if (!isinf (huge)) \ + abort (); \ + \ + if (isnan (norm)) \ + abort (); \ + \ + if (isinf (zero)) \ + abort (); \ + \ + \ + if (isfinite (nan)) \ + abort (); \ + \ + if (isfinite (inf)) \ + abort (); \ + \ + if (isfinite (huge)) \ + abort (); \ + \ + if (!isfinite (norm)) \ + abort (); \ + \ + if (!isfinite (zero)) \ + abort (); \ + \ + \ + if (isnormal (nan)) \ + abort (); \ + \ + if (isnormal (inf)) \ + abort (); \ + \ + if (isnormal (huge)) \ + abort (); \ + \ + if (!isnormal (norm)) \ + abort (); \ + \ + if (isnormal (zero)) \ + abort (); \ + \ + \ + if (signbit (norm)) \ + abort (); \ + \ + if (!signbit (-(norm))) \ + abort (); \ + \ + \ + if (!isgreater ((inf), (norm))) \ + abort (); \ + \ + if (!isgreaterequal ((inf), (huge))) \ + abort (); \ + \ + if (!isless ((norm), (inf))) \ + abort (); \ + \ + if (!islessequal ((huge), (inf))) \ + abort (); \ + \ + if (!islessgreater ((inf), (norm))) \ + abort (); \ + \ + if (!isunordered ((nan), (norm))) \ + abort (); \ +} -- cgit v1.1