Hi!

BINFO_BASE_BINFO always gives a TREE_BINFO, so using DECL_CONTEXT on it
is wrong.  The following patch fixes it to use BINFO_TYPE instead.

Bootstrapped/regtested on x86_64-linux and i686-linux, tested also on the
testcase in the PR.  Ok for trunk?

We don't seem to have infrastructure for testing errors during LTO linking,
so no testcase included.

2015-03-09  Jakub Jelinek  <ja...@redhat.com>

        PR lto/65361
        * ipa-devirt.c (add_type_duplicate): Don't use DECL_CONTEXT
        on a TREE_BINFO, instead use BINFO_TYPE.

--- gcc/ipa-devirt.c.jj 2015-03-09 08:05:13.000000000 +0100
+++ gcc/ipa-devirt.c    2015-03-09 16:23:42.277861689 +0100
@@ -1505,9 +1505,9 @@ add_type_duplicate (odr_type val, tree t
                extra_base = BINFO_BASE_BINFO
                             (TYPE_BINFO (val->type),
                              BINFO_N_BASE_BINFOS (TYPE_BINFO (type)));
-             inform (DECL_SOURCE_LOCATION
-                       (TYPE_NAME (DECL_CONTEXT (extra_base))),
-                     "the extra base is defined here ");
+             tree extra_base_type = BINFO_TYPE (extra_base);
+             inform (DECL_SOURCE_LOCATION (TYPE_NAME (extra_base_type)),
+                     "the extra base is defined here");
            }
          base_mismatch = true;
        }

        Jakub

Reply via email to