Blame SOURCES/gcc9-pr90303.patch

840d93
2019-05-03  Jakub Jelinek  <jakub@redhat.com>
840d93
840d93
	PR tree-optimization/90303
840d93
	* ipa-devirt.c (obj_type_ref_class, get_odr_type): Don't use
840d93
	TYPE_CANONICAL for TYPE_STRUCTURAL_EQUALITY_P types in !in_lto_p mode.
840d93
840d93
	* g++.target/i386/pr90303.C: New test.
840d93
840d93
--- gcc/ipa-devirt.c	(revision 270834)
840d93
+++ gcc/ipa-devirt.c	(revision 270835)
840d93
@@ -2020,7 +2020,7 @@ obj_type_ref_class (const_tree ref)
840d93
   ref = TREE_VALUE (TYPE_ARG_TYPES (ref));
840d93
   gcc_checking_assert (TREE_CODE (ref) == POINTER_TYPE);
840d93
   tree ret = TREE_TYPE (ref);
840d93
-  if (!in_lto_p)
840d93
+  if (!in_lto_p && !TYPE_STRUCTURAL_EQUALITY_P (ret))
840d93
     ret = TYPE_CANONICAL (ret);
840d93
   else
840d93
     ret = get_odr_type (ret)->type;
840d93
@@ -2042,7 +2042,7 @@ get_odr_type (tree type, bool insert)
840d93
   int base_id = -1;
840d93
 
840d93
   type = TYPE_MAIN_VARIANT (type);
840d93
-  if (!in_lto_p)
840d93
+  if (!in_lto_p && !TYPE_STRUCTURAL_EQUALITY_P (type))
840d93
     type = TYPE_CANONICAL (type);
840d93
 
840d93
   gcc_checking_assert (can_be_name_hashed_p (type)
840d93
--- gcc/testsuite/g++.target/i386/pr90303.C	(nonexistent)
840d93
+++ gcc/testsuite/g++.target/i386/pr90303.C	(revision 270835)
840d93
@@ -0,0 +1,8 @@
840d93
+// PR tree-optimization/90303
840d93
+// { dg-do compile { target ia32 } }
840d93
+// { dg-additional-options "-O2" }
840d93
+
840d93
+struct A { virtual void foo (); };
840d93
+template <class> class B : A {};
840d93
+typedef void (__attribute__((fastcall)) F) ();
840d93
+B<F> e;