[PATCH]: Also check subnormals in c99-math*

Kaveh R. GHAZI ghazi@caip.rutgers.edu
Mon Jul 2 03:42:00 GMT 2007


This patch adds checks for subnormal numbers in the c99-math checks
(written by Eric). Tested on sparc-sun-solaris2.10 by manually compiling
and running all the c99-math-*.c tests with current 4.1, 4.2 and mainline.

Ok everywhere?

		Thanks,
		--Kaveh


2007-07-01  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* gcc.dg/c99-math-double-1.c, gcc.dg/c99-math-float-1.c,
	c99-math-long-double-1.c, c99-math.h: Test subnormals.

diff -rup orig/egcc-SVN20070630/gcc/testsuite/gcc.dg/c99-math-double-1.c egcc-SVN20070630/gcc/testsuite/gcc.dg/c99-math-double-1.c
--- orig/egcc-SVN20070630/gcc/testsuite/gcc.dg/c99-math-double-1.c	2006-01-22 23:55:15.000000000 -0500
+++ egcc-SVN20070630/gcc/testsuite/gcc.dg/c99-math-double-1.c	2007-07-01 19:04:13.312450673 -0400
@@ -10,9 +10,10 @@ int main(void)
   double inf = INFINITY;
   double huge = HUGE_VAL;
   double norm = __DBL_MIN__;
+  double sub = __DBL_MIN__ / 2;
   double zero = 0.0;

-  C99_MATH_TESTS (nan, inf, huge, norm, zero)
+  C99_MATH_TESTS (nan, inf, huge, norm, sub, zero)

   return 0;
 }
diff -rup orig/egcc-SVN20070630/gcc/testsuite/gcc.dg/c99-math-float-1.c egcc-SVN20070630/gcc/testsuite/gcc.dg/c99-math-float-1.c
--- orig/egcc-SVN20070630/gcc/testsuite/gcc.dg/c99-math-float-1.c	2006-01-22 23:56:03.000000000 -0500
+++ egcc-SVN20070630/gcc/testsuite/gcc.dg/c99-math-float-1.c	2007-07-01 19:04:13.313338022 -0400
@@ -10,9 +10,10 @@ int main(void)
   float inf = INFINITY;
   float huge = HUGE_VALF;
   float norm = __FLT_MIN__;
+  float sub = __FLT_MIN__ / 2;
   float zero = 0.0f;

-  C99_MATH_TESTS (nan, inf, huge, norm, zero)
+  C99_MATH_TESTS (nan, inf, huge, norm, sub, zero)

   return 0;
 }
diff -rup orig/egcc-SVN20070630/gcc/testsuite/gcc.dg/c99-math-long-double-1.c egcc-SVN20070630/gcc/testsuite/gcc.dg/c99-math-long-double-1.c
--- orig/egcc-SVN20070630/gcc/testsuite/gcc.dg/c99-math-long-double-1.c	2006-01-22 23:55:31.000000000 -0500
+++ egcc-SVN20070630/gcc/testsuite/gcc.dg/c99-math-long-double-1.c	2007-07-01 19:04:13.313975969 -0400
@@ -10,9 +10,10 @@ int main(void)
   long double inf = INFINITY;
   long double huge = HUGE_VALL;
   long double norm = __LDBL_MIN__;
+  long double sub = __LDBL_MIN__ / 2;
   long double zero = 0.0l;

-  C99_MATH_TESTS (nan, inf, huge, norm, zero)
+  C99_MATH_TESTS (nan, inf, huge, norm, sub, zero)

   return 0;
 }
diff -rup orig/egcc-SVN20070630/gcc/testsuite/gcc.dg/c99-math.h egcc-SVN20070630/gcc/testsuite/gcc.dg/c99-math.h
--- orig/egcc-SVN20070630/gcc/testsuite/gcc.dg/c99-math.h	2007-07-01 19:04:23.053367965 -0400
+++ egcc-SVN20070630/gcc/testsuite/gcc.dg/c99-math.h	2007-07-01 19:04:13.315189693 -0400
@@ -2,7 +2,7 @@

 extern void abort(void);

-#define C99_MATH_TESTS(nan, inf, huge, norm, zero)	\
+#define C99_MATH_TESTS(nan, inf, huge, norm, sub, zero)	\
 {							\
   if (fpclassify (nan) != FP_NAN)			\
     abort ();						\
@@ -16,6 +16,9 @@ extern void abort(void);
   if (fpclassify (norm) != FP_NORMAL)			\
     abort ();						\
 							\
+  if (fpclassify (sub) != FP_SUBNORMAL)			\
+    abort ();						\
+							\
   if (fpclassify (zero) != FP_ZERO)			\
     abort ();						\
 							\
@@ -32,6 +35,9 @@ extern void abort(void);
   if (isnan (norm))					\
     abort ();						\
 							\
+  if (isnan (sub))					\
+    abort ();						\
+							\
   if (isnan (zero))					\
     abort ();						\
 							\
@@ -48,6 +54,9 @@ extern void abort(void);
   if (isinf (norm))					\
     abort ();						\
 							\
+  if (isinf (sub))					\
+    abort ();						\
+							\
   if (isinf (zero))					\
     abort ();						\
 							\
@@ -64,6 +73,9 @@ extern void abort(void);
   if (!isfinite (norm))					\
     abort ();						\
 							\
+  if (!isfinite (sub))					\
+    abort ();						\
+							\
   if (!isfinite (zero))					\
     abort ();						\
 							\
@@ -80,6 +92,9 @@ extern void abort(void);
   if (!isnormal (norm))					\
     abort ();						\
 							\
+  if (isnormal (sub))					\
+    abort ();						\
+							\
   if (isnormal (zero))					\
     abort ();						\
 							\



More information about the Gcc-patches mailing list