[Bug lto/83997] ICE with alias template and attribute

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jan 26 13:20:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83997

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems nothing actually handles the late attributes in TYPE_ATTRIBUTES that
aren't {RECORD,UNION,CLASS,ENUMERAL}_TYPE.

Tried:
--- pt.c.jj5    2018-01-24 17:18:42.393392254 +0100
+++ pt.c        2018-01-26 14:12:46.470745138 +0100
@@ -13662,18 +13662,43 @@ tsubst (tree t, tree args, tsubst_flags_
     case ERROR_MARK:
     case IDENTIFIER_NODE:
     case VOID_TYPE:
+    case LANG_TYPE:
+      return t;
+
     case REAL_TYPE:
     case COMPLEX_TYPE:
     case VECTOR_TYPE:
     case BOOLEAN_TYPE:
     case NULLPTR_TYPE:
-    case LANG_TYPE:
+      if (TYPE_ATTRIBUTES (t))
+       {
+         tree orig_t = t;
+         tree attributes = TYPE_ATTRIBUTES (t);
+         TYPE_ATTRIBUTES (t) = NULL_TREE;
+         apply_late_template_attributes (&t, attributes, 0,
+                                         args, complain, NULL_TREE);
+         if (t != orig_t)
+           TYPE_ATTRIBUTES (orig_t) = attributes;
+         fixup_attribute_variants (t);
+       }
       return t;

     case INTEGER_TYPE:
       if (t == integer_type_node)
        return t;

+      if (TYPE_ATTRIBUTES (t))
+       {
+         tree orig_t = t;
+         tree attributes = TYPE_ATTRIBUTES (t);
+         TYPE_ATTRIBUTES (t) = NULL_TREE;
+         apply_late_template_attributes (&t, attributes, 0,
+                                         args, complain, NULL_TREE);
+         if (t != orig_t)
+           TYPE_ATTRIBUTES (orig_t) = attributes;
+         fixup_attribute_variants (t);
+       }
+
       if (TREE_CODE (TYPE_MIN_VALUE (t)) == INTEGER_CST
           && TREE_CODE (TYPE_MAX_VALUE (t)) == INTEGER_CST)
         return t;
but even that is already ugly hack, but would need to deal with t becoming
something else after the apply_late_template_attributes call (VECTOR_TYPE in
this case).


More information about the Gcc-bugs mailing list