From d1700aa1407c188165eb8e06f40bf059a9b81b16 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 3 May 2019 09:32:06 +0200 Subject: [PATCH] re PR tree-optimization/90303 (ICE in hash_odr_name with fastcall attribute starting with r267359) PR tree-optimization/90303 * ipa-devirt.c (obj_type_ref_class, get_odr_type): Don't use TYPE_CANONICAL for TYPE_STRUCTURAL_EQUALITY_P types in !in_lto_p mode. * g++.target/i386/pr90303.C: New test. From-SVN: r270835 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-devirt.c | 4 ++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.target/i386/pr90303.C | 8 ++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.target/i386/pr90303.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5973192491a..2c4150d83e4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-05-03 Jakub Jelinek + + PR tree-optimization/90303 + * ipa-devirt.c (obj_type_ref_class, get_odr_type): Don't use + TYPE_CANONICAL for TYPE_STRUCTURAL_EQUALITY_P types in !in_lto_p mode. + 2019-05-03 Richard Biener PR tree-optimization/89698 diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index defa2ed3a5d..3e040e27305 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -2020,7 +2020,7 @@ obj_type_ref_class (const_tree ref) ref = TREE_VALUE (TYPE_ARG_TYPES (ref)); gcc_checking_assert (TREE_CODE (ref) == POINTER_TYPE); tree ret = TREE_TYPE (ref); - if (!in_lto_p) + if (!in_lto_p && !TYPE_STRUCTURAL_EQUALITY_P (ret)) ret = TYPE_CANONICAL (ret); else ret = get_odr_type (ret)->type; @@ -2042,7 +2042,7 @@ get_odr_type (tree type, bool insert) int base_id = -1; type = TYPE_MAIN_VARIANT (type); - if (!in_lto_p) + if (!in_lto_p && !TYPE_STRUCTURAL_EQUALITY_P (type)) type = TYPE_CANONICAL (type); gcc_checking_assert (can_be_name_hashed_p (type) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 660110d0493..509eb17752d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-05-03 Jakub Jelinek + + PR tree-optimization/90303 + * g++.target/i386/pr90303.C: New test. + 2019-05-03 Richard Biener PR tree-optimization/89698 diff --git a/gcc/testsuite/g++.target/i386/pr90303.C b/gcc/testsuite/g++.target/i386/pr90303.C new file mode 100644 index 00000000000..2a2dd06c2b3 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr90303.C @@ -0,0 +1,8 @@ +// PR tree-optimization/90303 +// { dg-do compile { target ia32 } } +// { dg-additional-options "-O2" } + +struct A { virtual void foo (); }; +template class B : A {}; +typedef void (__attribute__((fastcall)) F) (); +B e; -- 2.30.2