public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: java@gcc.gnu.org
Subject: Re: Mauve - the remainder (ieee_real_to_integer)
Date: Fri, 19 Apr 2002 17:02:00 -0000	[thread overview]
Message-ID: <1019256337.11256.29.camel@elsschot> (raw)
In-Reply-To: <1019080941.7866.133.camel@elsschot>

Hi,

Seeing that Andrew had solved the Double/Float/Long problems (on
powerpc) I tried to attack the remaining three Double/Float failures.

On Thu, 2002-04-18 at 00:02, Mark Wielaard wrote:
> 
> FAIL: gnu.testlet.java.lang.Double.DoubleTest: Error: test_intValue
> returned wrong results CYGNUS: Float to int conversions - 1 (number 1)
> 
> When compiling to byte-code the following prints zero:
> 
> public class DT
> {
> 	public static void main(String[] args)
> 	{
> 		System.out.println((int) 3.4e+32);
> 	}
> }
> 
> The actual buyte-code produced contains the zero. It should print
> 2147483647 (maxint), which it does when compiling from source.
> 
> FAIL: gnu.testlet.java.lang.Double.DoubleTest: Error: test_longValue
> returned wrong results CYGNUS: Float to int conversions - 1 (number 1)
> 
> Same kind of failure, but now for (long) 3.4e+32. The byte-code contains
> -4294967296 but the result should be 9223372036854775807 (maxlong).
> Compiling from source gives the correct result.
> 
> FAIL: gnu.testlet.java.lang.Float.FloatTest: Error: test_intValue
> returned wrong results - 1 (number 1)
> 
> Same for (int) 3.4e+32f.
> 
> Simple testcase for above failures attached. It succeeds when compiling
> from source, it fails when compiling to byte-code.

The solution to this one seemed to be this simple patch which makes sure
that even when we emit a class file the special
convert_ieee_real_to_integer is used and not just convert_to_integer.

diff -u -r1.44 typeck.c
--- typeck.c	3 Dec 2001 23:09:42 -0000	1.44
+++ typeck.c	19 Apr 2002 22:17:05 -0000
@@ -134,7 +134,6 @@
   if (code == INTEGER_TYPE)
     {
       if (! flag_unsafe_math_optimizations
-	  && ! flag_emit_class_files
 	  && TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
 	  && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT)
 	return fold (convert_ieee_real_to_integer (type, expr));

Sadly this is not the solution since with this patch I get one
regression: FAIL: Primes -O output from bytecode->native test
And although the new test program and the FloatTest produce correct
results the DoubleTest now gives:

gnu/testlet/java/lang/Double/DoubleTest.java: In class
`gnu.testlet.java.lang.Double.DoubleTest':
gnu/testlet/java/lang/Double/DoubleTest.java: In method
`gnu.testlet.java.lang.Double.DoubleTest.test_longValue()':
gnu/testlet/java/lang/Double/DoubleTest.java:310: verification error at
PC=32
gnu/testlet/java/lang/Double/DoubleTest.java:310: invalid argument type
gnu/testlet/java/lang/Double/DoubleTest.java:310: expected type
'boolean' but stack contains 'void'

Ah, well, nice try. And at least we now know were to look. I am going to
sleep. Feel free to surprise me with a real solution when I wake up :)

Good night,

Mark

  parent reply	other threads:[~2002-04-19 22:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-17 15:54 Mauve - the remainder Mark Wielaard
2002-04-17 16:24 ` Mark Wielaard
2002-04-18  8:31 ` Andrew Haley
2002-04-19 17:02 ` Mark Wielaard [this message]
2002-04-19 18:05 ` Tom Tromey

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=1019256337.11256.29.camel@elsschot \
    --to=mark@klomp.org \
    --cc=java@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).