When compiling the following code with "gcj -C" an error message orrurs correctly as with other java compilers too. With "gcj -c" this code gets compiled successfully (incorrectly) and works, but it should be rejected too. public class FinalTest { public static void main (String[] args) { System.out = new java.io.PrintStream(null); } }
Confirmed. Here is an example not dependent on System.out and shows the problem more clearly: class tt { static final tt tt1 = new tt(); tt() { } } public class FinalTest { public static void main (String[] args) { tt.tt1 = new tt(); } }
This is a regression from 3.0.4.
Retargeting to 3.4.1, being a regression on that release branch.
Postponed until GCC 3.4.2.
Postponed until GCC 3.4.3.
Postponed until GCC 3.4.4.
I looked into this today. When compiling to .o (or with --syntax-only), the "System.out" reference is wrapped in a compound_expr whose LHS initializes the System class. I'm working on this.
Subject: Bug 14853 CVSROOT: /cvs/gcc Module name: gcc Changes by: tromey@gcc.gnu.org 2004-12-06 15:30:57 Modified files: libjava : ChangeLog Added files: libjava/testsuite/libjava.compile: PR14853.java PR14853.xfail Log message: For PR java/14853: * testsuite/libjava.compile/PR14853.java: New file. * testsuite/libjava.compile/PR14853.xfail: New file. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.3259&r2=1.3260 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.compile/PR14853.java.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.compile/PR14853.xfail.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 14853 CVSROOT: /cvs/gcc Module name: gcc Changes by: tromey@gcc.gnu.org 2004-12-06 15:32:38 Modified files: gcc/java : ChangeLog java-tree.h parse.y check-init.c Log message: PR java/14853: * java-tree.h (extract_field_decl): Declare. * parse.y (extract_field_decl): Renamed from strip_out_static_field_access_decl. No longer static. * check-init.c (get_variable_decl): Unwrap COMPOUND_EXPRs. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1516&r2=1.1517 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/java-tree.h.diff?cvsroot=gcc&r1=1.223&r2=1.224 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/parse.y.diff?cvsroot=gcc&r1=1.524&r2=1.525 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/check-init.c.diff?cvsroot=gcc&r1=1.61&r2=1.62
Fix checked in, will appear in gcc 4.0
This is a regression on active branches, so the bug should stay open until it's fixed there. Is a backport of your patch feasable for the 3.4 and 3.3 branches?
The patch should probably apply as-is to 3.4.
Will you test it there then?
I'm building this for 3.4 right now. If it works ok I will submit it. I don't plan to try it for 3.3.
Subject: Bug 14853 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: tromey@gcc.gnu.org 2004-12-08 17:29:02 Modified files: libjava : ChangeLog Added files: libjava/testsuite/libjava.compile: PR14853.java PR14853.xfail Log message: For PR java/14853: * testsuite/libjava.compile/PR14853.java: New file. * testsuite/libjava.compile/PR14853.xfail: New file. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.2562.2.26&r2=1.2562.2.27 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.compile/PR14853.java.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.compile/PR14853.xfail.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
Subject: Bug 14853 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: tromey@gcc.gnu.org 2004-12-08 17:29:42 Modified files: gcc/java : ChangeLog check-init.c java-tree.h parse.y Log message: PR java/14853: * java-tree.h (extract_field_decl): Declare. * parse.y (extract_field_decl): Renamed from strip_out_static_field_access_decl. No longer static. * check-init.c (get_variable_decl): Unwrap COMPOUND_EXPRs. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1315.2.19&r2=1.1315.2.20 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/check-init.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.53&r2=1.53.10.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/java-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.194&r2=1.194.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/parse.y.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.464.4.2&r2=1.464.4.3
Fixed on the 3.4 branch also.