[ Reported to the Debian BTS as report #165635. Please CC 165635@bugs.debian.org on replies. Log of report can be found at http://bugs.debian.org/165635 ] [validated with gcj-3.2.1 prerelease and HEAD CVS 20021103] --- class Bug165635 { public static void main (String[] argLigneDeCommande) { int i=0; int a; int b=1; for (i=a; i<=b; i++){ System.out.println("i = "+i); } } } --- $ gcj-3.2 -C Bug165635.java Bug165635.java: In class `Bug165635': Bug165635.java: In method `Bug165635.main(java.lang.String[])': Bug165635.java:2: internal error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions. Release: 3.2.1 (Debian) (Debian unstable) Environment: System: Debian GNU/Linux (unstable) Architecture: i686 host: i386-linux Configured with: /home/packages/gcc/3.2/gcc-3.2-3.2.1ds5/src/configure -v --enable-languages=c,c++,java,f77,proto,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc i386-linux
still happens on the mainline (): tin:~/src/gnu/gcctest>gcj -C pr8608.java pr8608.java: In class `Bug165635': pr8608.java: In method `Bug165635.main(java.lang.String[])': pr8608.java:3: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. 3054 ctxp->elc.line = EXPR_WFL_LINENO (cl); (gdb) p cl $1 = 0x0 (gdb) bt #0 issue_warning_error_from_context (cl=0x0, msg=0x1 <Address 0x1 out of bounds>, ap=0x1 <Address 0x1 out of bounds>) at parse.y:3054 #1 0x08053daf in parse_error_context (cl=0x1, msg=0x1 <Address 0x1 out of bounds>) at parse.y:3078 #2 0x080d2b33 in check_init (exp=0x400ae000, before=0xbffec310) at /home/gates/ pinskia/src/gnu/gcc/src/gcc/java/check-init.c:490 #3 0x080d1c00 in check_init (exp=0x400550d8, before=0xbffec310) at /home/gates/ pinskia/src/gnu/gcc/src/gcc/java/check-init.c:520 #4 0x080d1e5a in check_init (exp=0x40055138, before=0xbffec310) at /home/gates/ pinskia/src/gnu/gcc/src/gcc/java/check-init.c:851 #5 0x080d20be in check_init (exp=0x400ad370, before=0xbffec310) at /home/gates/ pinskia/src/gnu/gcc/src/gcc/java/check-init.c:588 #6 0x080d20be in check_init (exp=0x400ad318, before=0xbffec310) at /home/gates/ pinskia/src/gnu/gcc/src/gcc/java/check-init.c:588 #7 0x080d20be in check_init (exp=0x400ad294, before=0xbffec310) at /home/gates/ pinskia/src/gnu/gcc/src/gcc/java/check-init.c:588 #8 0x080d41f1 in check_for_initialization (body=0x1, mdecl=0x0) at /home/gates/ pinskia/src/gnu/gcc/src/gcc/java/check-init.c:967 #9 0x0806733b in java_complete_expand_method (mdecl=0x0) at parse.y:7957 #10 0x08066176 in java_complete_expand_methods (class_decl=0x40077b64) at parse.y:7660 #11 0x08065e2f in java_complete_expand_class (outer=0x40077b64) at parse.y:7579 #12 0x08065d5d in java_complete_expand_classes () at parse.y:7558 #13 0x0806aad9 in java_expand_classes () at parse.y:8878 #14 0x080be552 in java_parse_file (set_yydebug=0) at /home/gates/pinskia/src/gnu/gcc/ src/gcc/java/jcf-parse.c:1119 #15 0x0830096a in compile_file () at /home/gates/pinskia/src/gnu/gcc/src/gcc/ toplev.c:2209 #16 0x08306528 in do_compile () at /home/gates/pinskia/src/gnu/gcc/src/gcc/ toplev.c:5581 #17 0x08306599 in toplev_main (argc=1, argv=0x0) at /home/gates/pinskia/src/gnu/gcc/ src/gcc/toplev.c:5612 #18 0x080d9a2b in main (argc=1, argv=0x1) at /home/gates/pinskia/src/gnu/gcc/src/gcc/ main.c:37
This seems to be still alive, $ gcj -C Bug165635.java Bug165635.java: In class `Bug165635': Bug165635.java: In method `Bug165635.main(java.lang.String[])': Bug165635.java:2: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. $ gcj -v Reading specs from /home/lindi/installdir/installdir-gcc-20041009/lib/gcc/i686-pc-linux-gnu/4.0.0/specs Reading specs from /home/lindi/installdir/installdir-gcc-20041009/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../libgcj.spec rename spec lib to liborig Configured with: ../configure --prefix=/home/lindi/installdir/installdir-gcc-20041009 Thread model: posix gcc version 4.0.0 20041009 (experimental)
The simplest testcase that reproduces this bug with the current mainline is: class Foo { void bar() { int a; int i; for(i=a;;); } } If the "int i" is removed and the for loop is changed to "for(int i=a;;);", the ICE disappears.
An ugly patch is here: http://gcc.gnu.org/ml/java-patches/2005-q1/msg00303.html
Subject: Bug 8608 CVSROOT: /cvs/gcc Module name: gcc Changes by: bothner@gcc.gnu.org 2005-03-01 17:24:55 Modified files: gcc/java : check-init.c ChangeLog Log message: PR java/8608 * check-init.c (wfl): Remove static. (final_assign_error, check_init): Replace calls to parse_error_context by plain error. (check_init): Save, set, and restore input_location for each exp. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/check-init.c.diff?cvsroot=gcc&r1=1.63&r2=1.64 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1558&r2=1.1559
Fixed in 4.1.0 and above.