Bug 21781 - real.c incorrectly values zero with a large exponent
Summary: real.c incorrectly values zero with a large exponent
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.1.0
: P3 minor
Target Milestone: 4.2.0
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid, wrong-code
Depends on:
Blocks: 16989 16620
  Show dependency treegraph
 
Reported: 2005-05-27 12:00 UTC by Neil Booth
Modified: 2006-03-16 18:27 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-01-26 05:24:02


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Neil Booth 2005-05-27 12:00:34 UTC
The following snippet, if compiled with -Wall, complains about a missing return
statement, indicating GCC is erroneously folding the comparison to false.

int foo(void) { if (.0e200000000 == 0 ) return 1; }
Comment 1 Andrew Pinski 2005-10-25 19:49:43 UTC
Confirmed, testcase which shows this is also a rejects valid:
int f[.0e200000000 == 0?1:-1];
Comment 2 Roger Sayle 2006-03-16 16:34:09 UTC
Subject: Bug 21781

Author: sayle
Date: Thu Mar 16 16:34:05 2006
New Revision: 112136

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112136
Log:

	PR middle-end/21781
	* real.c (real_from_string): If the mantissa is zero, don't bother
	parsing the exponent as the result should always be zero.

	* gcc.dg/real-const-1.c: New test case.


Added:
    trunk/gcc/testsuite/gcc.dg/real-const-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/real.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Andrew Pinski 2006-03-16 18:27:07 UTC
Fixed.