* [patch,testsuite] Fix PR testsuite/31828
@ 2007-09-29 19:27 John David Anglin
2007-10-01 17:25 ` Janis Johnson
0 siblings, 1 reply; 2+ messages in thread
From: John David Anglin @ 2007-09-29 19:27 UTC (permalink / raw)
To: gcc-patches; +Cc: janis187
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)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch,testsuite] Fix PR testsuite/31828
2007-09-29 19:27 [patch,testsuite] Fix PR testsuite/31828 John David Anglin
@ 2007-10-01 17:25 ` Janis Johnson
0 siblings, 0 replies; 2+ messages in thread
From: Janis Johnson @ 2007-10-01 17:25 UTC (permalink / raw)
To: John David Anglin; +Cc: gcc-patches
On Sat, 2007-09-29 at 13:45 -0400, John David Anglin wrote:
> 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?
OK.
Janis
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-10-01 17:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-29 19:27 [patch,testsuite] Fix PR testsuite/31828 John David Anglin
2007-10-01 17:25 ` Janis Johnson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).