Java: Fix TYPE_BINFO regression

Bryce McKinlay mckinlay@redhat.com
Fri Jul 9 23:25:00 GMT 2004


This patch caused a Java testsuite regression for 
libjava.compile/iface.java. The problem is that interface_of_p can 
segfault due to lack of TYPE_BINFO if set_super_info() has not yet been 
called on java.lang.Object. I'm checking in the patch below under the 
"obvious" rule.

Regards

Bryce


2004-07-09  Bryce McKinlay  <mckinlay@redhat.com>

    * class.c (interface_of_p): Check for null TYPE_BINFO.

--- class.c     9 Jul 2004 18:36:02 -0000       1.195
+++ class.c     9 Jul 2004 23:18:33 -0000
@@ -533,8 +533,9 @@
   int n, i;
   tree basetype_vec;
 
-  if (!(basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (type2))))
+  if (! TYPE_BINFO (type2))
     return 0;
+  basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (type2));
   n = TREE_VEC_LENGTH (basetype_vec);
   for (i = 0; i < n; i++)
     {


Nathan Sidwell wrote:

> This patch moves the java binfo construction next to the base binfo 
> vector,
> for the same reasons I changed C++%.  Fortunately, Java was waay simpler!
>
> built & tested on i686-pc-linux-gnu, ok?
>
> nathan
>
> % http://gcc.gnu.org/ml/gcc-patches/2004-07/msg00902.html if you 
> missed it.
>
>------------------------------------------------------------------------
>
>2004-07-09  Nathan Sidwell  <nathan@codesourcery.com>
>
>	* class.c (make_class): Do not create binfo here.
>	(set_super_info): Create it here.
>	* java-tree.h (CLASS_HAS_SUPER): Cope with lack of a binfo.
>  
>



More information about the Java-patches mailing list