This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]