When trying to compile GL4Java project .class files into native code GCJ crashes. I prepared minimal test case. Command I issue and its result: max@maxbox:~/gl4java_test$ gcj -v -save-temps --classpath ${LIBGCJ} -shared -o libgl4java.so gl4java/GL4JavaInitException.class gl4java/GLRunnable.class Reading specs from /home/max/gcc34/out/lib/gcc/i686-pc-linux-gnu/3.4.0/specs Reading specs from /home/max/gcc34/out/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../libgcj.spec rename spec lib to liborig Configured with: ../gcc/configure --prefix=/home/max/gcc34/out --with-system-zlib Thread model: posix gcc version 3.4.0 20040125 (prerelease) /home/max/gcc34/out/libexec/gcc/i686-pc-linux-gnu/3.4.0/jc1 /tmp/ccgrrBzxjx -fhash-synchronization -fno-use-divide-subroutine -fuse-boehm-gc -fnon-call-exceptions -fkeep-inline-functions -quiet -dumpbase ccgrrBzxjx -mtune=pentiumpro -auxbase ccgrrBzxjx -g1 -version -fclasspath=-shared -ffilelist-file -o ccgrrBzxjx.s GNU Java version 3.4.0 20040125 (prerelease) (i686-pc-linux-gnu) compiled by GNU C version 3.3.3 20040110 (prerelease) (Debian). GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64465 Class path starts here: -shared/ /home/max/gcc34/out/share/java/libgcj-3.4.0.jar/ (system) (zip) gl4java/GL4JavaInitException.class:0: 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. Contents of ccgrrBzxjx.s generated temp file: .file "ccgrrBzxjx" .section .debug_abbrev,"",@progbits .Ldebug_abbrev0: .section .debug_info,"",@progbits .Ldebug_info0: .section .debug_line,"",@progbits .Ldebug_line0: .text .Ltext0: I'm using GCC obtained from CVS gcc-3_4-branch on 2004.01.25 GCJ version: max@maxbox:~/gl4java_test$ gcj --version gcj (GCC) 3.4.0 20040125 (prerelease) Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. System: max@maxbox:~/gl4java_test$ uname -a Linux maxbox 2.4.24-1-686 #1 Tue Jan 6 21:29:44 EST 2004 i686 GNU/Linux I'll be happy to provide any help which would aid in resolving this problem. Max
Created attachment 5627 [details] gl4java/GL4JavaInitException.java
Created attachment 5628 [details] gl4java/GLRunnable.java
Created attachment 5629 [details] gl4java/GL4JavaInitException.class
Created attachment 5630 [details] gl4java/GLRunnable.class
I can reproduce this. The command line which I can reproduce this with: gcj -o libgl4java.so gl4java/GL4JavaInitException.class gl4java/GLRunnable.class Note you have include "-o filename" part else it will not seg fault.
Here is the backtrace: #0 add_miranda_methods (base_class=0x40c6aa80, search_class=0x40c6ac80) at /Users/ pinskia/src/gcc-checkin/src/gcc/java/class.c:2007 #1 0x0002a4c4 in add_miranda_methods (base_class=0x40c6aa80, search_class=0x40c6ac80) at /Users/pinskia/src/gcc-checkin/src/gcc/java/class.c:2048 #2 0x0002a3ac in layout_class_methods (this_class=0x40c6aa80) at /Users/pinskia/src/gcc- checkin/src/gcc/java/class.c:2079 #3 0x0000d354 in java_layout_seen_class_methods () at /Users/pinskia/src/gcc-checkin/src/gcc/ java/parse.y:7568 #4 0x000463d4 in parse_class_file () at /Users/pinskia/src/gcc-checkin/src/gcc/java/jcf-parse.c: 700 #5 0x00047550 in java_parse_file (set_yydebug=1086761600) at /Users/pinskia/src/gcc- checkin/src/gcc/java/jcf-parse.c:1106 #6 0x0005c198 in toplev_main (argc=1078371988, argv=0x4046a694) at /Users/pinskia/src/ gcc-checkin/src/gcc/toplev.c:1812 #7 0x00002534 in _start (argc=17, argv=0xbffffb7c, envp=0xbffffbc4) at /SourceCache/Csu/ Csu-46/crt.c:267 #8 0x000023a8 in start ()
Confirmed a regression from 3.3.1.
Java problems are not showstoppers, so I have pushed this back to GCC 3.4.1.
Yet another Miranda methods bug! FWIW, for me it happens *only* if I say: gcj -shared -o libgl4java.so gl4java/GL4JavaInitException.class gl4java/GLRunnable.class It *does not happen* if I: 1. Omit the "-o" flag (as Andrew Pinski points out). 2. Use Java sources instead of class files. 3. Reverse the order of the classes on the command line.
I've hit the same bug building Ant 1.6.1 from rhug. It happens while building bytecode from org/apache/tools/ant/types/selectors/BaseSelectorContainer.java. (gdb) where #0 0x080bcd93 in add_miranda_methods (base_class=0xf6d27244, search_class=0xf6d12b54) at /home/green/sources/jhbuild-src/gcc/gcc/java/class.c:2067 #1 0x080bd05b in add_miranda_methods (base_class=0xf6d27244, search_class=0xf6d27244) at /home/green/sources/jhbuild-src/gcc/gcc/java/class.c:2108 #2 0x080bd57a in layout_class_methods (this_class=0xf6d27244) at /home/green/sources/jhbuild-src/gcc/gcc/java/class.c:2140 #3 0x080bd397 in layout_class_methods (this_class=0xf66cf740) at /home/green/sources/jhbuild-src/gcc/gcc/java/class.c:2127 #4 0x080710a5 in java_layout_seen_class_methods () at parse.y:7587 #5 0x0807141e in java_layout_classes () at parse.y:7652 #6 0x08078a26 in java_expand_classes () at parse.y:9001 #7 0x080efb6f in java_parse_file (set_yydebug=0) at /home/green/sources/jhbuild-src/gcc/gcc/java/jcf-parse.c:1111 #8 0x08486e28 in compile_file () at /home/green/sources/jhbuild-src/gcc/gcc/toplev.c:1653 #9 0x08488769 in do_compile () at /home/green/sources/jhbuild-src/gcc/gcc/toplev.c:2699 #10 0x084887d0 in toplev_main (argc=19, argv=0xfeef1e84) at /home/green/sources/jhbuild-src/gcc/gcc/toplev.c:2731 #11 0x0810a90e in main (argc=19, argv=0xfeef1e84) at /home/green/sources/jhbuild-src/gcc/gcc/main.c:35
Postponed until 3.4.2.
My proposed patch is here: http://gcc.gnu.org/ml/java-patches/2004-q2/msg00664.html
Subject: Bug 13948 CVSROOT: /cvs/gcc Module name: gcc Changes by: rmathew@gcc.gnu.org 2004-06-17 13:45:24 Modified files: gcc/java : ChangeLog parse.y jcf-parse.c Log message: Fixes PR java/13948 * parse.y (java_layout_seen_class_methods): Ensure class is loaded before trying to lay out its methods. * jcf-parse.c (read_class): Track parsed files using canonical paths obtained via lrealpath from libiberty. (java_parse_file): Likewise. (parse_source_file_1): Rename formal parameter to reflect its modified purpose. Minor formatting fix. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1380&r2=1.1381 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/parse.y.diff?cvsroot=gcc&r1=1.480&r2=1.481 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/jcf-parse.c.diff?cvsroot=gcc&r1=1.159&r2=1.160
I have the patch installed, but I'm still seeing the same failure in ant.
(In reply to comment #14) > I have the patch installed, but I'm still seeing the same failure in ant. Are you using the latest CVS sources? Bryce also fixed a couple of class loading bugs recently (after the fix above went in). If the problem still persists, can you at least give the backtrace with a "debug_tree()" of the class that is causing problems?
Postponed until GCC 3.4.3.
I can build the rhug ant just fine with current cvs head. I'm closing this; I'll ping Anthony to see if he still has problems.