Bug 6388 - Integer.MIN_VALUE == 0x80000000 optimized to false on powerpc
Summary: Integer.MIN_VALUE == 0x80000000 optimized to false on powerpc
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 3.1
: P3 normal
Target Milestone: 3.3
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-21 02:06 UTC by Mark Wielaard
Modified: 2005-11-13 06:36 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2002-04-21 02:06:00 UTC
The following program (compiled to byte or native code):

public class IT
{
    public static void main(String[] args)
    {
        System.out.println(Integer.MIN_VALUE);
        System.out.println(0x80000000);
        System.out.println(Integer.MIN_VALUE == 0x80000000);
        System.out.println(0x80000000 == 0x80000000); 
    }
}

Should produce the following output (as it does on i686):

-2147483648
-2147483648
true
true

But on powerpc it produces:

-2147483648
-2147483648
false
true

Release:
gcj 3.1
Comment 1 Tom Tromey 2002-06-12 10:06:04 UTC
Responsible-Changed-From-To: unassigned->tromey
Responsible-Changed-Why: I'm handling this.
Comment 2 Tom Tromey 2002-06-12 10:06:04 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: The lexer assumes that HOST_WIDE_INT is 32 bits,
    leading to problems on PPC Linux, where it is 64 bits.
    I wrote a first hacky patch, but it needs a rewrite.
Comment 3 Tom Tromey 2002-10-23 22:56:13 UTC
From: tromey@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: java/6388
Date: 23 Oct 2002 22:56:13 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	tromey@gcc.gnu.org	2002-10-23 15:56:13
 
 Modified files:
 	libjava/testsuite: ChangeLog 
 Added files:
 	libjava/testsuite/libjava.lang: pr6388.java pr6388.out 
 
 Log message:
 	For PR java/6388:
 	* libjava.lang/pr6388.java: New file.
 	* libjava.lang/pr6388.out: New file.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.221&r2=1.222
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.lang/pr6388.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.lang/pr6388.out.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 4 Tom Tromey 2002-11-02 21:26:28 UTC
From: tromey@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: java/6388
Date: 2 Nov 2002 21:26:28 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	tromey@gcc.gnu.org	2002-11-02 13:26:28
 
 Modified files:
 	gcc/java       : ChangeLog decl.c java-tree.h lex.c lex.h 
 
 Log message:
 	Fix for PR java/6388.
 	* lex.h (JAVA_INTEGRAL_RANGE_ERROR): Wrap in do...while.
 	* java-tree.h (enum java_tree_index): New values
 	JTI_DECIMAL_INT_MAX_NODE, JTI_DECIMAL_LONG_MAX_NODE.
 	(decimal_int_max, decimal_long_max): New defines.
 	* lex.c (yylex): Rewrote range checking.  Sign extend literals.
 	(error_if_numeric_overflow): Rewrote range checking.
 	* decl.c (java_init_decl_processing): Initialize decimal_int_max,
 	decimal_long_max.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1077&r2=1.1078
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/decl.c.diff?cvsroot=gcc&r1=1.132&r2=1.133
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/java-tree.h.diff?cvsroot=gcc&r1=1.158&r2=1.159
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/lex.c.diff?cvsroot=gcc&r1=1.92&r2=1.93
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/lex.h.diff?cvsroot=gcc&r1=1.26&r2=1.27
 
Comment 5 Tom Tromey 2002-11-05 16:02:03 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: I've checked in the fix
Comment 6 Tom Tromey 2002-11-06 00:01:01 UTC
From: tromey@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: java/6388
Date: 6 Nov 2002 00:01:01 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	tromey@gcc.gnu.org	2002-11-05 16:01:01
 
 Modified files:
 	gcc/java       : ChangeLog decl.c java-tree.h lex.c lex.h 
 
 Log message:
 	Fix for PR java/6388.
 	* lex.h (JAVA_INTEGRAL_RANGE_ERROR): Wrap in do...while.
 	* java-tree.h (enum java_tree_index): New values
 	JTI_DECIMAL_INT_MAX_NODE, JTI_DECIMAL_LONG_MAX_NODE.
 	(decimal_int_max, decimal_long_max): New defines.
 	* lex.c (yylex): Rewrote range checking.  Sign extend literals.
 	(error_if_numeric_overflow): Rewrote range checking.
 	* decl.c (java_init_decl_processing): Initialize decimal_int_max,
 	decimal_long_max.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1081&r2=1.1082
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/decl.c.diff?cvsroot=gcc&r1=1.134&r2=1.135
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/java-tree.h.diff?cvsroot=gcc&r1=1.161&r2=1.162
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/lex.c.diff?cvsroot=gcc&r1=1.94&r2=1.95
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/lex.h.diff?cvsroot=gcc&r1=1.28&r2=1.29
Comment 7 GCC Commits 2004-10-29 07:07:11 UTC
Subject: Bug 6388

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_2-rhl8-branch
Changes by:	jakub@gcc.gnu.org	2004-10-29 07:06:57

Modified files:
	gcc/java       : ChangeLog decl.c java-tree.h lex.c lex.h 

Log message:
	2002-11-05  Tom Tromey  <tromey@redhat.com>
	
	Fix for PR java/6388.
	* lex.h (JAVA_INTEGRAL_RANGE_ERROR): Wrap in do...while.
	* java-tree.h (enum java_tree_index): New values
	JTI_DECIMAL_INT_MAX_NODE, JTI_DECIMAL_LONG_MAX_NODE.
	(decimal_int_max, decimal_long_max): New defines.
	* lex.c (yylex): Rewrote range checking.  Sign extend literals.
	(error_if_numeric_overflow): Rewrote range checking.
	* decl.c (java_init_decl_processing): Initialize decimal_int_max,
	decimal_long_max.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.925.2.59.2.2.2.11&r2=1.925.2.59.2.2.2.12
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.117.2.2.8.1&r2=1.117.2.2.8.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/java-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.136.2.3.4.1&r2=1.136.2.3.4.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/lex.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.80.8.4.8.1&r2=1.80.8.4.8.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/lex.h.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.26&r2=1.26.30.1