[Bug c++/16977] New: Bogus warning using HUGE_VAL

thor at math dot tu-berlin dot de gcc-bugzilla@gcc.gnu.org
Wed Aug 11 08:40:00 GMT 2004


g++3.4 generates a bogus warning when using the ANSI defined HUGE_VAL floating
point constant when compiling with -pedantic. To reproduce, enter the following
test program and save it as test.c:

/* snip */
#include <cmath>

int main(int argc,char **argv)
{
  double v = HUGE_VAL;
  
  return 0;
}
/* snip */

and compile it with

$ g++3.4 -pedantic test.c

g++ reports the following warnings on compilation:

test.c:5:14: warning: use of C99 hexadecimal floating constant
test.c: In function `int main(int, char**)':
test.c:5: warning: floating constant exceeds range of "double"

However, the above program is fully within the limits of ANSI-C++ and
well-defined, so it should not warn at all, not even with -pedantic.

-- 
           Summary: Bogus warning using HUGE_VAL
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: minor
          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
  GCC host triplet: i686-pc-linux
GCC target triplet: i686-pc-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16977



More information about the Gcc-bugs mailing list