When compiling a simple java file with gcj the compiler output a segfault. After several test and simplifications, it appears that the conditions of this failure is:
- Use the -findirect-dispatch flag - Use the --jni flag - The class contains at last one jni method - The class contains at last one constructor If one this condition is unmet, the compilation succeed. I tried compilling the .java, .class and .jar file, each time with the same result. Using strace the segfaulting program seems to be jc1 I have the same result with: - gcj-4.2 (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu6) - gcj-4.3 (GCC) 4.3.0 [Compiled from sources] -- Compiler output: $ gcj-4.3 -findirect-dispatch --jni Test.java -c Test.java: In class 'Test': Test.java: In method 'foo()': Test.java:0: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. -- Test case: public class Test { public native void foo (); public Test () { } } -- strace part (with gcj 4.2 on Ubuntu) [pid 13927] execve("/usr/lib/gcc/i486-linux-gnu/4.2.3/jc1", ["/usr/lib/gcc/i486-linux-gnu/4.2."..., "Test.class", "-fhash-synchronization", "-fno-use-divide-subroutine", "-fuse-boehm-gc", "-fnon-call-exceptions", "-fkeep-inline-functions", "-quiet", "-dumpbase", "Test.class", "-mtune=generic", "-auxbase", "Test", "-g1", "-findirect-dispatch", "-fjni", ...], [/* 38 vars */]) = 0 -- Summary: Segfault with -findirect-dispatch and --jni Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: java AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: william dot fink at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36247