PR c++/84314 - ICE with templates and fastcall attribute.
authorJason Merrill <jason@redhat.com>
Wed, 21 Feb 2018 22:12:08 +0000 (17:12 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 21 Feb 2018 22:12:08 +0000 (17:12 -0500)
* attribs.c (build_type_attribute_qual_variant): Remove assert.

From-SVN: r257883

gcc/ChangeLog
gcc/attribs.c
gcc/testsuite/g++.dg/ext/attrib56.C [new file with mode: 0644]

index 2905e18e59995b763fb1bdc52a3fee5edccdf404..6b14ff47faedb2eed9d820136e4b23e53625feb6 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-21  Jason Merrill  <jason@redhat.com>
+
+       PR c++/84314 - ICE with templates and fastcall attribute.
+       * attribs.c (build_type_attribute_qual_variant): Remove assert.
+
 2018-02-21  Jan Hubicka  <hubicka@ucw.cz>
 
        * ipa-cp.c (determine_versionability): Fix comment typos.
index caa30b99fc6fe35b5932df3bc16bd718b89e0442..bfadf124dcb0f682c32400be7b94d41c84c4dce9 100644 (file)
@@ -1155,17 +1155,14 @@ build_type_attribute_qual_variant (tree otype, tree attribute, int quals)
           TYPE_CANONICAL.  */;
       else if (TYPE_STRUCTURAL_EQUALITY_P (ttype)
               || !comp_type_attributes (ntype, ttype))
-       {
-         /* If the target-dependent attributes make NTYPE different from
-            its canonical type, we will need to use structural equality
-            checks for this type.
-
-            But make sure we don't get here for stripping attributes from a
-            type; the no-attribute type might not need structural comparison,
-            and it should have been in the hash table already.  */
-         gcc_assert (attribute);
-         SET_TYPE_STRUCTURAL_EQUALITY (ntype);
-       }
+       /* If the target-dependent attributes make NTYPE different from
+          its canonical type, we will need to use structural equality
+          checks for this type.
+
+          We shouldn't get here for stripping attributes from a type;
+          the no-attribute type might not need structural comparison.  But
+          we can if was discarded from type_hash_table.  */
+       SET_TYPE_STRUCTURAL_EQUALITY (ntype);
       else if (TYPE_CANONICAL (ntype) == ntype)
        TYPE_CANONICAL (ntype) = TYPE_CANONICAL (ttype);
 
diff --git a/gcc/testsuite/g++.dg/ext/attrib56.C b/gcc/testsuite/g++.dg/ext/attrib56.C
new file mode 100644 (file)
index 0000000..9736d97
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/84314
+// { dg-do compile { target { { i?86-*-* x86_64-*-* } && ia32 } } }
+
+struct a {
+  void b(long() __attribute__((fastcall))) {}
+};