aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-devirt.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2019-10-01 20:21:31 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2019-10-01 18:21:31 +0000
commit56f1a16caeb447934c4c5209664984560b17e63a (patch)
tree3367f01cba2008b23c701a10e85e333bd508bcf1 /gcc/ipa-devirt.c
parenta9346b558b58edbc9ffceacbb23a26c61eac4bf9 (diff)
downloadgcc-56f1a16caeb447934c4c5209664984560b17e63a.zip
gcc-56f1a16caeb447934c4c5209664984560b17e63a.tar.gz
gcc-56f1a16caeb447934c4c5209664984560b17e63a.tar.bz2
re PR c++/91222 (507.cactuBSSN_r build fails in warn_types_mismatch at ipa-devirt.c:1006 since r273571)
PR lto/91222 * ipa-devirt.c (warn_types_mismatch): Do not ICE when anonymous type is matched with non-C++ type * g++.dg/lto/odr-6_0.C: New testcase. * g++.dg/lto/odr-6_1.c: New testcase. From-SVN: r276420
Diffstat (limited to 'gcc/ipa-devirt.c')
-rw-r--r--gcc/ipa-devirt.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index e5028bc..3423c40 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -992,14 +992,14 @@ warn_types_mismatch (tree t1, tree t2, location_t loc1, location_t loc2)
std::swap (t1, t2);
std::swap (loc_t1, loc_t2);
}
- gcc_assert (TYPE_NAME (t1) && TYPE_NAME (t2)
- && TREE_CODE (TYPE_NAME (t1)) == TYPE_DECL
- && TREE_CODE (TYPE_NAME (t2)) == TYPE_DECL);
+ gcc_assert (TYPE_NAME (t1)
+ && TREE_CODE (TYPE_NAME (t1)) == TYPE_DECL);
tree n1 = TYPE_NAME (t1);
- tree n2 = TYPE_NAME (t2);
+ tree n2 = TYPE_NAME (t2) ? TYPE_NAME (t2) : NULL;
+
if (TREE_CODE (n1) == TYPE_DECL)
n1 = DECL_NAME (n1);
- if (TREE_CODE (n2) == TYPE_DECL)
+ if (n2 && TREE_CODE (n2) == TYPE_DECL)
n2 = DECL_NAME (n2);
/* Most of the time, the type names will match, do not be unnecesarily
verbose. */