[PATCH] Use types_compatible_p in get_binfo_at_offset

Jan Hubicka hubicka@ucw.cz
Sat May 11 00:16:00 GMT 2013


> 
> The existing check should work ok with lto. If not then we should figure out why we do not merge the main variants properly.
Hmm, adding:
Index: tree.c
===================================================================
--- tree.c      (revision 198796)
+++ tree.c      (working copy)
@@ -11572,6 +11572,12 @@ get_binfo_at_offset (tree binfo, HOST_WI
 
       if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (expected_type))
          return binfo;
+      else
+       if (types_compatible_p (type, expected_type))
+         {
+           debug_tree (TYPE_MAIN_VARIANT (type));
+           debug_tree (TYPE_MAIN_VARIANT (expected_type));
+         }
       if (offset < 0)
        return NULL_TREE;
 
@@ -11605,6 +11611,12 @@ get_binfo_at_offset (tree binfo, HOST_WI
                found_binfo = base_binfo;
                break;
              }
+             else
+               if (types_compatible_p (TREE_TYPE (base_binfo), TREE_TYPE (fld)))
+                 {
+                   debug_tree (TREE_TYPE (base_binfo));
+                   debug_tree (TREE_TYPE (fld));
+                 }
          if (!found_binfo)
            return NULL_TREE;
          binfo = found_binfo;

seems to bring a lot of positives and by quick inspection most of them seem
like same classes.  I will try to find some time to debug this more. But
glancing over the the dumps, I see many of them just have different name
spaces.  Do we even attempt to merge namespace_decl? How types from same
namespaces in different units are supposed to match?

Honza
> 
> Richard.
> 
> >Honza
> 



More information about the Gcc-patches mailing list