Patch: 3.3 fix for PR java/9695

Tom Tromey tromey@redhat.com
Fri Feb 28 04:27:00 GMT 2003


This patch fixes PR java/9695.

The bug here is that compiling Classpath with gcj fails.  We don't see
this failure when compiling libgcj because Classpath compiles all the
files in one go, and libgcj does not.

do_resolve_class expects its `cl' argument to be an
EXPR_WITH_FILE_LOCATION.  The crash in question occurs because one
infrequently-executed code path will call do_resolve_class with a
plain class.  This fix works by wrapping the class before passing it
on.

Tested by compiling Classpath.  This also rebuilt libgcj correctly,
and passed the test suite, including Jacks and Mauve, with no
regressions.

Ok for 3.3 and trunk?

Tom

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

	PR java/9695:
	* class.c (maybe_layout_super_class): Always pass a WFL to
	do_resolve_class.

Index: class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.153
diff -u -r1.153 class.c
--- class.c 20 Feb 2003 17:51:46 -0000 1.153
+++ class.c 28 Feb 2003 02:47:47 -0000
@@ -1726,8 +1726,19 @@
 	super_class = TREE_TYPE (super_class);
       else
 	{
+	  /* do_resolve_class expects an EXPR_WITH_FILE_LOCATION, so
+	     we give it one.  */
+	  tree this_wrap = NULL_TREE;
+
+	  if (this_class)
+	    {
+	      tree this_decl = TYPE_NAME (this_class);
+	      this_wrap = build_expr_wfl (this_class,
+					  DECL_SOURCE_FILE (this_decl),
+					  DECL_SOURCE_LINE (this_decl), 0);
+	    }
 	  super_class = do_resolve_class (NULL_TREE, /* FIXME? */
-					  super_class, NULL_TREE, this_class);
+					  super_class, NULL_TREE, this_wrap);
 	  if (!super_class)
 	    return NULL_TREE;	/* FIXME, NULL_TREE not checked by caller. */
 	  super_class = TREE_TYPE (super_class);



More information about the Java-patches mailing list