Description of problem: Compilation by naive gcj usage results in ICE instead of a complaint. Version-Release number of selected component (if applicable): gcc-java-4.1.1-26.i386 How reproducible: Always. Steps to Reproduce: 1. gcc -o hello hello.java Actual results: hello.java:1: internal compiler error: in uses_jv_markobj_p, at java/boehm.c:245 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://bugzilla.redhat.com/bugzilla> for instructions. Expected results: /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../lib64/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' /tmp/cc4WVJmk.o: In function `hello::main(JArray<java::lang::String*>*)': hello.java:(.text+0x12): undefined reference to `_Jv_InitClass' hello.java:(.text+0x20): undefined reference to `java::lang::System::class$' hello.java:(.text+0x25): undefined reference to `_Jv_InitClass' hello.java:(.text+0x2c): undefined reference to `java::lang::System::out' /tmp/cc4WVJmk.o: In function `hello::hello()': hello.java:(.text+0x61): undefined reference to `java::lang::Object::Object()' /tmp/cc4WVJmk.o:(.data+0x80): undefined reference to `java::lang::Object::finalize()' /tmp/cc4WVJmk.o:(.data+0x88): undefined reference to `java::lang::Object::hashCode()' /tmp/cc4WVJmk.o:(.data+0x90): undefined reference to `java::lang::Object::equals(java::lang::Object*)' /tmp/cc4WVJmk.o:(.data+0x98): undefined reference to `java::lang::Object::toString()' /tmp/cc4WVJmk.o:(.data+0xa0): undefined reference to `java::lang::Object::clone()' /tmp/cc4WVJmk.o:(.data+0xa8): undefined reference to `java::lang::Object::throwNoSuchMethodError()' /tmp/cc4WVJmk.o:(.data+0x120): undefined reference to `vtable for java::lang::Class' /tmp/cc4WVJmk.o:(.data+0x148): undefined reference to `java::lang::Object::class$' /tmp/cc4WVJmk.o:(.eh_frame+0x12): undefined reference to `__gcj_personality_v0' collect2: ld returned 1 exit status Additional info: Aware now the right way is to call: gcj -o hello --main=hello hello.java
Created attachment 137329 [details] The "hello.java" trivia source referenced above
Note this happens also with gcc -o hello hello.class, so can't be simply WONTFIXed as we don't support direct .java -> .o compilation using gcj. When using the gcj driver as opposed to gcc, -fuse-boehm-gc is passed among other options and with that switch this doesn't ICE.
We should probably delete the -fuse-boehm-gc option, since we never use anything else. By the way, the best way to get stuff like this fixed is to file it upstream.
In comment #2: I assume you mean we don't support direct .java->.o compilation using *gcc* (not gcj)? In comment #3: yeah, we should probably delete that option. We still won't support using the gcc driver, though, since there are other options passed via the .spec file. Maybe we could make the gcc driver give an error if it sees something intended for jc1.
Posted upstream, simple patch included but ICE fix required by pinskia there: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30292