Compilation by naive gcj usage results in ICE instead of a complaint. gcc-4.1.1, sources are the same in HEAD.
$ gcc -o hello hello.java 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. Without ICE the result would be still confusing: /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 Aware now the right way is to call: gcj -o hello --main=hello hello.java Attached patch errors out by: 'hello.java' must be compiled by the java gcj(1) driver but maybe some more spec-friendly solution would exist? Originally submitted as: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=208454 -- Summary: ICE on compiling .java by gcc(1) Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: driver AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jan dot kratochvil at redhat dot com GCC host triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30292