This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/4378: too large constant should be an error
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c/4378: too large constant should be an error
- From: Hallvard B Furuseth <h dot b dot furuseth at usit dot uio dot no>
- Date: Sun, 23 Sep 2001 04:58:41 +0200
>Number: 4378
>Category: c
>Synopsis: too large constant should be an error
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Sat Sep 22 20:06:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Hallvard B Furuseth
>Release: 3.0.1
>Organization:
University of Oslo
>Environment:
System: SunOS bombur.uio.no 5.8 Generic_108528-03 sun4u sparc SUNW,Ultra-5_10
Architecture: sun4
host: sparc-sun-solaris2.8
build: sparc-sun-solaris2.8
target: sparc-sun-solaris2.8
configured with: ../gcc-3.0.1/configure --prefix=/usit/bombur/hbf --program-suffix=3 --enable-version-specific-runtime-libs --enable-languages=c --quiet
>Description:
A too large floating constant is a constraint violation of
ANSI 3.1.3 (n869 6.4.4p2), but does not give an error even with
-ansi -pedantic-errors.
Unlike a too large integer constant, which does give error.
OTOH, these do give a misleading error message with -pedantic-errors:
"truncated to 64 bits". This makes it look like the compilation
does not fail.
In any case, I fail to see why it makes sense to _not_ make
this an error. I'd think that any program which gets this
warning gets compiled with incorrect data. (Maybe except
overflow into the sign bit only, if that can happen.
Under -traditional, maybe?)
>How-To-Repeat:
$ cat bug.c
double d = 9e999;
float f = 99999999999999999999999999999999999999999999999.9f;
$ gcc -ansi -pedantic-errors -S bug.c
bug.c:1: warning: floating point number exceeds range of 'double'
bug.c:2: warning: floating point number exceeds range of 'float'
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: