This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
crash compiling class file in subdir
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- Date: Mon, 12 Dec 2005 12:00:15 -0200
- Subject: crash compiling class file in subdir
Given the following testcase:
[aoliva@livre reduced]$ cat test/t.java
package test;
public class t extends u {}
[aoliva@livre reduced]$ cat test/u.java
package test;
public class u { }
[aoliva@livre reduced]$ gcj -C test/t.java
[aoliva@livre reduced]$ gcj -c test/t.class
jc1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.
Moving the files out of package test makes the ice go away.
set_source_filename () would not set the decl source location if it
thought the new file name would provide no additional info over what
it already had. This would leave DECL_SOURCE_LOCATION and
file_start_location with a NULL filename, which would end up causing
the crash.
This patch fixes it. Ok to install?
Index: gcc/java/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* jcf-parse.c (set_source_filename): Set the decl source location
even when returning early.
Index: gcc/java/jcf-parse.c
===================================================================
--- gcc/java/jcf-parse.c.orig 2005-12-12 10:57:47.000000000 -0200
+++ gcc/java/jcf-parse.c 2005-12-12 10:59:11.000000000 -0200
@@ -142,7 +142,13 @@
&& strcmp (sfname, old_filename + old_len - new_len) == 0
&& (old_filename[old_len - new_len - 1] == '/'
|| old_filename[old_len - new_len - 1] == '\\'))
- return;
+ {
+#ifndef USE_MAPPED_LOCATION
+ DECL_SOURCE_LOCATION (TYPE_NAME (current_class)) = input_location;
+ file_start_location = input_location;
+#endif
+ return;
+ }
}
if (strchr (sfname, '/') == NULL && strchr (sfname, '\\') == NULL)
{
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}