public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/21720] New: GCC incorrectly rounds hex floats
@ 2005-05-23 15:01 neil at gcc dot gnu dot org
  2005-05-23 15:44 ` [Bug c/21720] " jsm28 at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: neil at gcc dot gnu dot org @ 2005-05-23 15:01 UTC (permalink / raw)
  To: gcc-bugs

Unlike decimal floats, correctly rounding hex floats is easy and cheap, so we
should do it.  Moreover the standard requires it.

With -Wall GCC complains that the following function is missing a return
statement because it has incorrectly folded the comparison to false.

int foo(void) { if (0x1.0000010000000000000000000000000000000001p0f != 1) return
1; }

Remove one of the long line of zeroes and the precision falls within GCC's
limits and it works.

-- 
           Summary: GCC incorrectly rounds hex floats
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: neil at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21720


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/21720] GCC incorrectly rounds hex floats
  2005-05-23 15:01 [Bug c/21720] New: GCC incorrectly rounds hex floats neil at gcc dot gnu dot org
@ 2005-05-23 15:44 ` jsm28 at gcc dot gnu dot org
  2005-07-29  2:15 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-05-23 15:44 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |16989
              nThis|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21720


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/21720] GCC incorrectly rounds hex floats
  2005-05-23 15:01 [Bug c/21720] New: GCC incorrectly rounds hex floats neil at gcc dot gnu dot org
  2005-05-23 15:44 ` [Bug c/21720] " jsm28 at gcc dot gnu dot org
@ 2005-07-29  2:15 ` cvs-commit at gcc dot gnu dot org
  2005-07-29  5:35 ` [Bug middle-end/21720] " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-29  2:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-29 01:24 -------
Subject: Bug 21720

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jsm28@gcc.gnu.org	2005-07-29 01:24:39

Modified files:
	gcc            : ChangeLog real.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: hex-round-1.c 

Log message:
	PR c/21720
	* real.c (real_from_string): Set last bit if there is a nonzero
	hex digit beyond GCC's internal precision.
	
	testsuite:
	* gcc.dg/hex-round-1.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9593&r2=2.9594
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/real.c.diff?cvsroot=gcc&r1=1.155&r2=1.156
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5847&r2=1.5848
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/hex-round-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21720


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/21720] GCC incorrectly rounds hex floats
  2005-05-23 15:01 [Bug c/21720] New: GCC incorrectly rounds hex floats neil at gcc dot gnu dot org
  2005-05-23 15:44 ` [Bug c/21720] " jsm28 at gcc dot gnu dot org
  2005-07-29  2:15 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-29  5:35 ` pinskia at gcc dot gnu dot org
  2005-07-29 18:31 ` jsm28 at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-29  5:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-29 05:35 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|c                           |middle-end
           Keywords|                            |diagnostic, wrong-code
         Resolution|                            |FIXED
   Target Milestone|---                         |4.1.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21720


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/21720] GCC incorrectly rounds hex floats
  2005-05-23 15:01 [Bug c/21720] New: GCC incorrectly rounds hex floats neil at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-07-29  5:35 ` [Bug middle-end/21720] " pinskia at gcc dot gnu dot org
@ 2005-07-29 18:31 ` jsm28 at gcc dot gnu dot org
  2005-07-29 21:14 ` cvs-commit at gcc dot gnu dot org
  2005-07-29 23:24 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-07-29 18:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jsm28 at gcc dot gnu dot org  2005-07-29 18:31 -------
It turns out my patch actually fixed a similar problem with the code handling
digits before the ".", and my testcase didn't have enough zeroes to show the
problem on 64-bit hosts.  Testing a patch to fix the problem properly (by making
the same change to the code for digits after the "." and expanding the testcase).


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu dot org
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|FIXED                       |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21720


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/21720] GCC incorrectly rounds hex floats
  2005-05-23 15:01 [Bug c/21720] New: GCC incorrectly rounds hex floats neil at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-07-29 18:31 ` jsm28 at gcc dot gnu dot org
@ 2005-07-29 21:14 ` cvs-commit at gcc dot gnu dot org
  2005-07-29 23:24 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-29 21:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-29 21:14 -------
Subject: Bug 21720

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jsm28@gcc.gnu.org	2005-07-29 21:14:22

Modified files:
	gcc            : ChangeLog real.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/gcc.dg: hex-round-1.c 
Added files:
	gcc/testsuite/gcc.dg: hex-round-2.c 

Log message:
	PR c/21720
	* real.c (real_from_string): Also set last bit if there is a
	nonzero hex digit beyond GCC's internal precision after ".".
	
	testsuite:
	* gcc.dg/hex-round-1.c: Test more cases.
	* gcc.dg/hex-round-2.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9606&r2=2.9607
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/real.c.diff?cvsroot=gcc&r1=1.156&r2=1.157
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5852&r2=1.5853
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/hex-round-2.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/hex-round-1.c.diff?cvsroot=gcc&r1=1.1&r2=1.2



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21720


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/21720] GCC incorrectly rounds hex floats
  2005-05-23 15:01 [Bug c/21720] New: GCC incorrectly rounds hex floats neil at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-07-29 21:14 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-29 23:24 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-29 23:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-29 23:24 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21720


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-07-29 23:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-23 15:01 [Bug c/21720] New: GCC incorrectly rounds hex floats neil at gcc dot gnu dot org
2005-05-23 15:44 ` [Bug c/21720] " jsm28 at gcc dot gnu dot org
2005-07-29  2:15 ` cvs-commit at gcc dot gnu dot org
2005-07-29  5:35 ` [Bug middle-end/21720] " pinskia at gcc dot gnu dot org
2005-07-29 18:31 ` jsm28 at gcc dot gnu dot org
2005-07-29 21:14 ` cvs-commit at gcc dot gnu dot org
2005-07-29 23:24 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).