https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64470

            Bug ID: 64470
           Summary: “floating constant exceeds range” warning for
                    constants that should fit
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tg at mirbsd dot org

>From what I understand, 0x1.0p1024 (and 1E1024 which also warns) should fit
into a “double” if __DBL_MAX_EXP__ is 1024. This is a reduced testcase; the
original problem used 0x1.0p1024L but __LDBL_MAX_EXP__ on ARM is also 1024.

(sid-amd64)tglase@tglase:~ $ cat x.c
double foo = 0x1.0p1024;
(sid-amd64)tglase@tglase:~ $ /usr/lib/gcc-snapshot/bin/gcc -Woverflow -c x.c
x.c:1:1: warning: floating constant exceeds range of 'double' [-Woverflow]
 double foo = 0x1.0p1024;
 ^
(sid-amd64)tglase@tglase:~ $ /usr/lib/gcc-snapshot/bin/gcc --version
gcc (Debian 20141218-1) 5.0.0 20141218 (experimental) [trunk revision 218861]
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

(sid-amd64)tglase@tglase:~ $ :| /usr/lib/gcc-snapshot/bin/gcc -E -dD - | fgrep
DBL_MAX_EXP                 
#define __DBL_MAX_EXP__ 1024
#define __LDBL_MAX_EXP__ 16384

This warning is spewn in libc/stdio/_fpmaxtostr.c in µClibc-ng, which we’re
trying to get to build warning-free at the moment.

Reply via email to