This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch,testsuite] Fix PR testsuite/31828
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: gcc-patches at gcc dot gnu dot org
- Cc: janis187 at us dot ibm dot com
- Date: Sat, 29 Sep 2007 13:45:50 -0400 (EDT)
- Subject: [patch,testsuite] Fix PR testsuite/31828
The tests gcc.dg/float-range-[3-5].c use a C99 macro FP_INFINITE without
the c99_runtime check. In looking at these tests, I realized that the
use of FP_INFINITE was a likely typo since FP_INFINITE is an integer
constant. I believe that the overflow check should be using the float
INFINITY.
On non-C99 systems, we can use the builtin __builtin_inff() to define
INFINITY, so we don't need the c99_runtime check.
Tested on hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11. Ok for trunk?
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2007-09-29 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR testsuite/31828
gcc.dg/float-range-3.c (INFINITY): Define if not defined.
(overflow): Use INFINITY, not FP_INFINITE.
gcc.dg/float-range-4.c: Likewise.
gcc.dg/float-range-5.c: Likewise.
Index: gcc.dg/float-range-4.c
===================================================================
--- gcc.dg/float-range-4.c (revision 128862)
+++ gcc.dg/float-range-4.c (working copy)
@@ -3,17 +3,21 @@
/* { dg-options "-Wno-overflow -std=c99" } */
#include <math.h>
+#ifndef INFINITY
+#define INFINITY (__builtin_inff ())
+#endif
+
void overflow(void)
{
float f1 = 3.5E+38f;
float f2 = -3.5E+38f;
- float f3 = FP_INFINITE;
- float f4 = -FP_INFINITE;
+ float f3 = INFINITY;
+ float f4 = -INFINITY;
double d1 = 1.9E+308;
double d2 = -1.9E+308;
- double d3 = FP_INFINITE;
- double d4 = -FP_INFINITE;
+ double d3 = INFINITY;
+ double d4 = -INFINITY;
}
void underflow(void)
Index: gcc.dg/float-range-3.c
===================================================================
--- gcc.dg/float-range-3.c (revision 128862)
+++ gcc.dg/float-range-3.c (working copy)
@@ -3,17 +3,21 @@
/* { dg-options "-std=c99" } */
#include <math.h>
+#ifndef INFINITY
+#define INFINITY (__builtin_inff ())
+#endif
+
void overflow(void)
{
float f1 = 3.5E+38f; /* { dg-warning "floating constant exceeds range" } */
float f2 = -3.5E+38f; /* { dg-warning "floating constant exceeds range" } */
- float f3 = FP_INFINITE;
- float f4 = -FP_INFINITE;
+ float f3 = INFINITY;
+ float f4 = -INFINITY;
double d1 = 1.9E+308; /* { dg-warning "floating constant exceeds range" } */
double d2 = -1.9E+308; /* { dg-warning "floating constant exceeds range" } */
- double d3 = FP_INFINITE;
- double d4 = -FP_INFINITE;
+ double d3 = INFINITY;
+ double d4 = -INFINITY;
}
void underflow(void)
Index: gcc.dg/float-range-5.c
===================================================================
--- gcc.dg/float-range-5.c (revision 128862)
+++ gcc.dg/float-range-5.c (working copy)
@@ -4,17 +4,21 @@
/* { dg-options "-pedantic-errors -std=c99" } */
#include <math.h>
+#ifndef INFINITY
+#define INFINITY (__builtin_inff ())
+#endif
+
void overflow(void)
{
float f1 = 3.5E+38f; /* { dg-warning "floating constant exceeds range" } */
float f2 = -3.5E+38f; /* { dg-warning "floating constant exceeds range" } */
- float f3 = FP_INFINITE;
- float f4 = -FP_INFINITE;
+ float f3 = INFINITY;
+ float f4 = -INFINITY;
double d1 = 1.9E+308; /* { dg-warning "floating constant exceeds range" } */
double d2 = -1.9E+308; /* { dg-warning "floating constant exceeds range" } */
- double d3 = FP_INFINITE;
- double d4 = -FP_INFINITE;
+ double d3 = INFINITY;
+ double d4 = -INFINITY;
}
void underflow(void)