This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: avoid crash with gcj -fno-assume-compiled


Today I tried -fno-assume-compiled, and got a crash:

fleche. gcj --syntax-only -fno-assume-compiled=org.apache.foo foo.java 
jc1: internal compiler error: Segmentation fault


The appended patch fixes this crash, and makes the logic in
add_assume_compiled correct (this function was checking `ident'
instead of `parent->ident').

Ok for trunk?  (Not the 3.3 branch since Jeff's assume-compiled
patches aren't there.  If/when those are moved over, this can move at
the same time.)

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* class.c (add_assume_compiled): Don't adjust parent if we're
	already at the root of tree.

Index: class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.142
diff -u -r1.142 class.c
--- class.c 1 Jan 2003 15:10:00 -0000 1.142
+++ class.c 6 Jan 2003 23:44:05 -0000
@@ -150,6 +150,7 @@
      const char *ident;
      int excludep;
 {
+  int len;
   assume_compiled_node *parent;
   assume_compiled_node *node = 
     xmalloc (sizeof (assume_compiled_node));
@@ -183,7 +184,8 @@
      class or a package name.  Adjust PARENT accordingly.  */
 
   parent = find_assume_compiled_node (assume_compiled_tree, ident);
-  if (ident[strlen (parent->ident)] != '.')
+  len = strlen (parent->ident);
+  if (parent->ident[len] && parent->ident[len] != '.')
     parent = parent->parent;
 
   /* Insert NODE into the tree.  */
@@ -194,7 +196,7 @@
 }
 
 /* Returns nonzero if IDENT is the name of a class that the compiler
-   should assume has been compiled to FIXME  */
+   should assume has been compiled to object code.  */
 
 static int
 assume_compiled (ident)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]