]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR tree-optimization/90303 (ICE in hash_odr_name with fastcall attribute...
authorJakub Jelinek <jakub@redhat.com>
Fri, 17 May 2019 19:48:25 +0000 (21:48 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 17 May 2019 19:48:25 +0000 (21:48 +0200)
Backported from mainline
2019-05-03  Jakub Jelinek  <jakub@redhat.com>

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: r271349

gcc/ChangeLog
gcc/ipa-devirt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.target/i386/pr90303.C [new file with mode: 0644]

index 85a51841830e612c4c0147df95ef50903f3628aa..d3c8c5e4e94dbe575920197fbc43008647b9944d 100644 (file)
@@ -1,3 +1,12 @@
+2019-05-17  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2019-05-03  Jakub Jelinek  <jakub@redhat.com>
+
+       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-17  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
index defa2ed3a5dc95bbd8411be1d04b8037bc9f9212..3e040e273058f27f9aaa595117aff9496baf7f2f 100644 (file)
@@ -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)
index 1f6da940d34cdf08e543054b901f084900052f11..466f08ccecfcbad867108851373ed660c25d1bac 100644 (file)
@@ -1,3 +1,11 @@
+2019-05-17  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2019-05-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/90303
+       * g++.target/i386/pr90303.C: New test.
+
 2019-05-15  Li Jia He  <helijia@linux.ibm.com>
 
        Backport from mainline.
diff --git a/gcc/testsuite/g++.target/i386/pr90303.C b/gcc/testsuite/g++.target/i386/pr90303.C
new file mode 100644 (file)
index 0000000..2a2dd06
--- /dev/null
@@ -0,0 +1,8 @@
+// PR tree-optimization/90303
+// { dg-do compile { target ia32 } }
+// { dg-additional-options "-O2" }
+
+struct A { virtual void foo (); };
+template <class> class B : A {};
+typedef void (__attribute__((fastcall)) F) ();
+B<F> e;