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/64470] New: âfloating constant exceeds rangeâ warning for constants that should fit


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.

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