From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21090 invoked by alias); 21 Apr 2002 09:46:06 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 21043 invoked by uid 71); 21 Apr 2002 09:46:02 -0000 Resent-Date: 21 Apr 2002 09:46:01 -0000 Resent-Message-ID: <20020421094601.21041.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, java-prs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, mark@klomp.org Received:(qmail 19916 invoked by uid 61); 21 Apr 2002 09:43:55 -0000 Message-Id:<20020421094355.19915.qmail@sources.redhat.com> Date: Sun, 21 Apr 2002 02:46:00 -0000 From: mark@klomp.org Reply-To: mark@klomp.org To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: java/6391: Constant float to int conversions don't use ieee_real_to_integer when compiled to byte-code X-SW-Source: 2002-04/txt/msg01063.txt.bz2 List-Id: >Number: 6391 >Category: java >Synopsis: Constant float to int conversions don't use ieee_real_to_integer when compiled to byte-code >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Sun Apr 21 02:46:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: mark@klomp.org >Release: gcj 3.1 >Organization: >Environment: >Description: See also the following thread: http://gcc.gnu.org/ml/java/2002-04/msg00255.html The following program: public class DFT { public static void main(String[] args) { System.out.println((int) 3.4e+32); System.out.println((long) 3.4e+32); System.out.println((int) 3.4e+32f); System.out.println((long) 3.4e+32f); } } Should produce the following output (which is does when compiling to native code): 2147483647 9223372036854775807 2147483647 9223372036854775807 But when compiling to byte-code it gives: 0 -4294967296 0 -4294967296 The problem seemed to be solved by the following 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 above test program and the Mauve FloatTest produce correct results the Mauve 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' >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: