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]

PATH to inherits_from_p


I checked the atached patch into mainline.
It is probably appropriate for 4.0.2.

The problem is that CLASSTYPE_SUPER may be unset if we haven't loaded the class yet, which can obviously lead to various failures. In the case that motivated the patch, I got an error about a throws specifier
because it there's wasn't a matching throws in the super class. However, it wasm't needed since it was a RuntimeException.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
2005-06-12  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.231
diff -u -p -r1.231 class.c
--- class.c	3 Jun 2005 04:06:19 -0000	1.231
+++ class.c	12 Jun 2005 19:53:36 -0000
@@ -549,6 +549,8 @@ inherits_from_p (tree type1, tree type2)
     {
       if (type1 == type2)
 	return 1;
+      if (! CLASS_LOADED_P (type1))
+	load_class (type1, 1);
       type1 = CLASSTYPE_SUPER (type1);
     }
   return 0;

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