public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "wilson at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug libgcj/26483] Wrong parsing of doubles when interpreted on ia64
Date: Wed, 08 Mar 2006 00:46:00 -0000	[thread overview]
Message-ID: <20060308004639.17969.qmail@sourceware.org> (raw)
In-Reply-To: <bug-26483-3744@http.gcc.gnu.org/bugzilla/>



------- Comment #10 from wilson at gcc dot gnu dot org  2006-03-08 00:46 -------
I missed the denorm angle obviously.  And the answer to the question about what
is different between native and interpreted execution would of course be
libffi, which took me far longer to remember than it should have.

Anyways, looking at libffi, the issue appears to be the stf_spill function in
the src/ia64/ffi.c file.  This function spills an FP value to the stack, taking
as argument a _float80 value, which is effectively a long double.  So when we
pass the denorm double to stf_spill, it gets normalized to a long double, and
this normalization appears to be causing all of the trouble.  This long double
value then gets passed to dtoa in fdlibm which expects a double argument.  dtoa
then fails.  I didn't debug dtoa to see why it fails, but it seems clear if we
pass it an argument of the wrong type, we are asking for trouble.

On IA-64, FP values are always stored in FP regs as a long double value rounded
to the appropriate type, so the normalization will have no effect except on
denorm values I think.  This means only single-denorm and double-denorm
arguments values are broken, which is something that would be easy to miss
without a testcase.

Stepping through ffi_call in gdb at the point whjere stf_spill is called, I see
the incoming value is 
f6             4.9406564584124654417656879286822137e-324        (raw
0x000000000000fc010000000000000800)
which has the minimum double exponent (fc01) and a denorm fraction (0...800). 
After the conversion to _float80, we have
f6             4.9406564584124654417656879286822137e-324        (raw
0x000000000000fbcd8000000000000000)
This now has an exponent invalid for double (fbcd) and a normal fraction
(800...0).

If I rewrite stf_spill to be a macro instead of a function, to avoid the
argument type conversion, then the testcase works for both gcj and gij.

ldf_spill appears to have the same problem, and is in need of the same
solution.


-- 

wilson at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wilson at gcc dot gnu dot
                   |                            |org


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


  parent reply	other threads:[~2006-03-08  0:46 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-27 16:18 [Bug libgcj/26483] New: Wrong parsing of doubles when interpreted konqueror at gmx dot de
2006-02-27 16:20 ` [Bug libgcj/26483] " konqueror at gmx dot de
2006-02-27 17:03 ` pinskia at gcc dot gnu dot org
2006-02-27 17:26 ` konqueror at gmx dot de
2006-02-28  3:25 ` wilson at gcc dot gnu dot org
2006-02-28 21:15 ` joseph at codesourcery dot com
2006-02-28 21:40 ` schwab at suse dot de
2006-02-28 21:50 ` joseph at codesourcery dot com
2006-02-28 22:02 ` schwab at suse dot de
2006-03-06 17:08 ` [Bug libgcj/26483] Wrong parsing of doubles when interpreted on ia64 tromey at gcc dot gnu dot org
2006-03-08  0:46 ` wilson at gcc dot gnu dot org [this message]
2006-03-08  0:51 ` wilson at gcc dot gnu dot org
2006-04-04 19:07 ` tromey at gcc dot gnu dot org
2006-04-04 20:22 ` wilson at tuliptree dot org
2006-04-04 20:24 ` wilson at gcc dot gnu dot org
2006-04-04 20:46 ` andreast at gcc dot gnu dot org
2006-04-07 23:01 ` wilson at tuliptree dot org
2006-04-07 23:04 ` wilson at gcc dot gnu dot org
2006-04-12 22:10 ` wilson at gcc dot gnu dot org
2006-04-12 22:21 ` wilson at gcc dot gnu dot org
2006-04-12 22:22 ` wilson at gcc dot gnu dot org
2006-05-26 14:58 ` konqueror at gmx dot de
2006-06-01 22:36 ` wilson at gcc dot gnu dot org
2006-06-17  1:01 ` tromey at gcc dot gnu dot org

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=20060308004639.17969.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.gnu.org \
    /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).