This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

4.0 Patch: Fix PR java/21418


Another patch backport from HEAD. Ranjit's java/21418 fix and also a small change from Per that it depends on. These are needed to reliably build classpath. I'm checking them in.

Bryce

2005-10-01  Ranjit Mathew  <rmathew@gcc.gnu.org>

        PR java/21418
        * class.c (inherits_from_p): Try to lay out super class
        if it is not already laid out.
        (maybe_layout_super_class): Handle the case where SUPER_CLASS
        is a NULL_TREE.

2005-10-01  Per Bothner  <per@bothner.com>

        * class.c (inherits_from_p): Do load_class if needed.

Index: class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.220.8.6
diff -u -r1.220.8.6 class.c
--- class.c	1 Oct 2005 06:20:38 -0000	1.220.8.6
+++ class.c	1 Oct 2005 06:44:55 -0000
@@ -545,7 +545,11 @@
     {
       if (type1 == type2)
 	return 1;
-      type1 = CLASSTYPE_SUPER (type1);
+
+      if (! CLASS_LOADED_P (type1))
+	load_class (type1, 1);
+
+      type1 = maybe_layout_super_class (CLASSTYPE_SUPER (type1), type1);
     }
   return 0;
 }
@@ -2045,7 +2049,9 @@
 static tree
 maybe_layout_super_class (tree super_class, tree this_class)
 {
-  if (TREE_CODE (super_class) == RECORD_TYPE)
+  if (!super_class)
+    return NULL_TREE;
+  else if (TREE_CODE (super_class) == RECORD_TYPE)
     {
       if (!CLASS_LOADED_P (super_class) && CLASS_FROM_SOURCE_P (super_class))
 	safe_layout_class (super_class);
@@ -2060,13 +2066,13 @@
 	super_class = TREE_TYPE (super_class);
       else
 	{
-	  /* Set the correct context for class resolution.  */
-	  current_class = this_class;
-
 	  /* do_resolve_class expects an EXPR_WITH_FILE_LOCATION, so
 	     we give it one.  */
 	  tree this_wrap = NULL_TREE;
 
+	  /* Set the correct context for class resolution.  */
+	  current_class = this_class;
+
 	  if (this_class)
 	    {
 	      tree this_decl = TYPE_NAME (this_class);

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