Bug 19907 - Incorrect code generated for ManifestElement.java
Summary: Incorrect code generated for ManifestElement.java
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Andrew Haley
URL:
Keywords: patch, wrong-code
: 19834 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-02-11 16:35 UTC by Andrew Haley
Modified: 2005-02-14 15:16 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-02-11 16:41:01


Attachments
ManifestElement.class (593 bytes, application/octet-stream)
2005-02-11 16:37 UTC, Andrew Haley
Details
The source for this .class file. (264 bytes, text/plain)
2005-02-11 16:43 UTC, Andrew Haley
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Haley 2005-02-11 16:35:47 UTC
The bytecode compiler generates incorrect code for the attached .class file.
Comment 1 Andrew Haley 2005-02-11 16:37:31 UTC
Created attachment 8177 [details]
ManifestElement.class
Comment 2 Andrew Haley 2005-02-11 16:41:01 UTC
The method ArrayList.add() return a boolean, so the bytecode compiler generates
a temp of type promoted_boolean.  Unfortunately, the same temp is used later as
an int.

This problem arises because promoted booleans in the Java VM are really an
integer type, not a boolean type.  It's perfectly legal to store a boolean and
then read an int for the same slot.  So, we need to use int temporaries for
booleans, not promoted_boolean.
Comment 3 Andrew Haley 2005-02-11 16:43:51 UTC
Created attachment 8180 [details]
The source for this .class file.
Comment 4 Andrew Pinski 2005-02-11 20:50:34 UTC
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-02/msg00521.html>.
Comment 5 Bryce McKinlay 2005-02-11 20:56:36 UTC
*** Bug 19834 has been marked as a duplicate of this bug. ***
Comment 6 Andrew Haley 2005-02-12 13:29:19 UTC
The patch I submitted is inadequate.  I know how to fix it, and I'll resubmit.
Comment 7 GCC Commits 2005-02-14 14:58:28 UTC
Subject: Bug 19907

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	aph@gcc.gnu.org	2005-02-14 14:58:23

Modified files:
	gcc/java       : ChangeLog expr.c decl.c 

Log message:
	2005-02-14  Andrew Haley  <aph@redhat.com>
	
	PR java/19907
	* expr.c (expand_byte_code): Call promote_arguments().
	(promote_arguments): New function.
	* decl.c (check_local_unnamed_variable): Remve special case for
	new verifier.
	(find_local_variable): Promote all boolean types to int
	when searching for local variable decls.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1550&r2=1.1551
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/expr.c.diff?cvsroot=gcc&r1=1.217&r2=1.218
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/decl.c.diff?cvsroot=gcc&r1=1.208&r2=1.209

Comment 8 Andrew Pinski 2005-02-14 15:16:28 UTC
Fixed.