The bytecode compiler generates incorrect code for the attached .class file.
Created attachment 8177 [details] ManifestElement.class
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.
Created attachment 8180 [details] The source for this .class file.
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-02/msg00521.html>.
*** Bug 19834 has been marked as a duplicate of this bug. ***
The patch I submitted is inadequate. I know how to fix it, and I'll resubmit.
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
Fixed.