public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: Alexandre Oliva <aoliva@redhat.com>
Cc: R Hill <dirtyepic.sk@gmail.com>, Nick Clifton <nickc@redhat.com>,
		binutils@sources.redhat.com, gcc@gcc.gnu.org
Subject: Gcc 4.2 miscompiles binutils on x86 and x86-64
Date: Sun, 30 Apr 2006 11:23:00 -0000	[thread overview]
Message-ID: <20060429235415.GA6521@lucon.org> (raw)
In-Reply-To: <or3bfwushl.fsf@free.oliva.athome.lsd.ic.unicamp.br>

On Sat, Apr 29, 2006 at 03:49:42PM -0300, Alexandre Oliva wrote:
> On Apr 29, 2006, "H. J. Lu" <hjl@lucon.org> wrote:
> 
> > On Sat, Apr 29, 2006 at 12:14:03AM -0600, R Hill wrote:
> >> 
> >> Testcase is:
> >> 
> >> .tfloat 1.442695040888963407359924681002
> >> 
> >> Binutils is 2.16.92, configured with:
> >> 
> 
> > It works for me with binutils in CVS and the Linux binutils
> > 2.16.91.0.7. Does the Linux binutils 2.16.91.0.7 work for you?
> 
> H.J., we've gone through this before.  You didn't use GCC trunk to
> build binutils, which is what triggers the bug.
> 

It looks like a gcc bug to me. Gcc 4.2 miscompiles:

     more_than_enough_bits_for_digits
        = (number_of_digits_to_use * 3321928 / 1000000 + 1);

in atof_generic. When number_of_digits_to_use == 1, gcc 4.2 -O2 gets
more_than_enough_bits_for_digits as 4. The correct value is 37. I
am checking in this patch to warn users.


H.J.
----
2006-04-29  H.J. Lu  <hongjiu.lu@intel.com>

	* gas/i386/fp.d: New file.
	* gas/i386/fp.s: Likewise.

	* gas/i386/i386.exp: Run "fp".

--- gas/testsuite/gas/i386/fp.d.fp	2006-04-29 15:39:27.000000000 -0700
+++ gas/testsuite/gas/i386/fp.d	2006-04-29 15:55:50.000000000 -0700
@@ -0,0 +1,8 @@
+#objdump: -s -j .data
+#name: i386 fp
+
+.*:     file format .*
+
+Contents of section .data:
+ 0000 00881bcd 4b789ad4 004071a3 79094f93  ....Kx...@q.y.O.
+ 0010 0a40789a 5440789a 54400000 00000000  .@x.T@x.T@......
--- gas/testsuite/gas/i386/fp.s.fp	2006-04-29 15:39:23.000000000 -0700
+++ gas/testsuite/gas/i386/fp.s	2006-04-29 15:59:52.000000000 -0700
@@ -0,0 +1,13 @@
+	.data
+# .tfloat is 80-bit floating point format.
+	.tfloat 3.32192809488736218171e0
+#	.byte 0x0, 0x88, 0x1b, 0xcd, 0x4b, 0x78, 0x9a, 0xd4, 0x0, 0x40
+# .double is 64-bit floating point format.
+	.double 3.32192809488736218171e0
+#	.byte 0x71, 0xa3, 0x79, 0x09, 0x4f, 0x93, 0x0a, 0x40
+# The next two are 32-bit floating point format.
+	.float 3.32192809488736218171e0
+#	.byte 0x78, 0x9a, 0x54, 0x40, 0, 0, 0, 0
+	.single 3.32192809488736218171e0
+#	.byte 0x78, 0x9a, 0x54, 0x40, 0, 0, 0, 0
+	.byte 0, 0, 0, 0, 0, 0
--- gas/testsuite/gas/i386/i386.exp.fp	2006-03-07 15:40:19.000000000 -0800
+++ gas/testsuite/gas/i386/i386.exp	2006-04-29 15:40:01.000000000 -0700
@@ -71,6 +71,7 @@ if [expr ([istarget "i*86-*-*"] ||  [ist
     run_dump_test "merom"
     run_dump_test "rep"
     run_dump_test "rep-suffix"
+    run_dump_test "fp"
 
     # These tests require support for 8 and 16 bit relocs,
     # so we only run them for ELF and COFF targets.

      reply	other threads:[~2006-04-29 23:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-02 18:07 can't build x86-32 libc on x86-64 with mainline binutils Alexandre Oliva
2006-03-02 18:33 ` H. J. Lu
2006-03-02 18:44   ` Alexandre Oliva
2006-03-02 18:49     ` H. J. Lu
2006-03-02 18:56       ` Alexandre Oliva
2006-03-02 19:01         ` H. J. Lu
2006-03-03  9:56     ` Nick Clifton
2006-04-29 23:54       ` R Hill
2006-04-30  0:02         ` H. J. Lu
2006-04-30  6:53           ` Alexandre Oliva
2006-04-30 11:23             ` H. J. Lu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060429235415.GA6521@lucon.org \
    --to=hjl@lucon.org \
    --cc=aoliva@redhat.com \
    --cc=binutils@sources.redhat.com \
    --cc=dirtyepic.sk@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).