Using the command line switches -pedantic -ffast-math triggers an error and
aborts compilation of code using HUGE_VAL.
To reproduce, save the following code as huge.cpp:
#include <math.h>
#include <stdio.h>
int main(int argc,char **argv)
{
double v = HUGE_VAL;
printf("%f\n",v);
return 0;
}
Compile with:
g++-4.0 -ffast-math -pedantic huge.cpp
Result is:
huge.cpp:6:14: warning: use of C99 hexadecimal floating constant
huge.cpp:6: error: floating constant exceeds range of 'double'
Compilation aborts here. Note that there is a similar bug in the database,
namely #11931 that exists at least since g++-3.3.2 and has not been touched
yet. Unfortunately, starting with g++-4.0.1, this bug causes an unjustified
error (not just a warning) and thus avoids compilation of existing
production code. Bug #11931 has been marked as priority "low"; however,
since this bug remained in the bug data base for so long now, and since it
is now even raised to an error instead of just a warning, I would like to
suggest to raise the priority to "normal".
And please, please: Could please someone care about this one?
So long, and thanks a lot,
Thomas
--
Summary: -pedantic -ffast-math breaks working code
Product: gcc
Version: 4.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: thor at math dot tu-berlin dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23139