OK.
On Wed, Apr 5, 2017 at 5:37 PM, Marek Polacek <pola...@redhat.com> wrote: > We crashed on this testcase because UNDERLYING_TYPE, a C++-specific code, > got into layout_type. It wound up there via strip_typedefs -> ... -> > build_type_attribute_qual_variant and that calls type_hash_canon which > has > 7129 /* The TYPE_ALIGN field of a type is set by layout_type(), so we > 7130 must call that routine before comparing TYPE_ALIGNs. */ > 7131 layout_type (type); > I think best would be to fix this in strip_typedefs, much like how we handle > some other _TYPE nodes. > > I checked in gdb what results we get and it seems that strip_typedefs now > returns what I would expect it to, i.e. an UNDERLYING_TYPE with the attribute > removed. > > Bootstrapped/regtested on x86_64-linux, ok for trunk? > > 2017-04-05 Marek Polacek <pola...@redhat.com> > > PR c++/80244 - ICE with attribute in template alias. > * tree.c (strip_typedefs): Handle UNDERLYING_TYPE. > > * g++.dg/cpp0x/alias-decl-59.C: New test. > > diff --git gcc/cp/tree.c gcc/cp/tree.c > index 2757af6..1f0e422 100644 > --- gcc/cp/tree.c > +++ gcc/cp/tree.c > @@ -1531,6 +1531,10 @@ strip_typedefs (tree t, bool *remove_attributes) > DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (t), > tf_none)); > break; > + case UNDERLYING_TYPE: > + type = strip_typedefs (UNDERLYING_TYPE_TYPE (t), remove_attributes); > + result = finish_underlying_type (type); > + break; > default: > break; > } > diff --git gcc/testsuite/g++.dg/cpp0x/alias-decl-59.C > gcc/testsuite/g++.dg/cpp0x/alias-decl-59.C > index e69de29..1f5e94f 100644 > --- gcc/testsuite/g++.dg/cpp0x/alias-decl-59.C > +++ gcc/testsuite/g++.dg/cpp0x/alias-decl-59.C > @@ -0,0 +1,11 @@ > +// PR c++/80244 > +// { dg-do compile { target c++11 } } > + > +template<typename> > +struct A {}; > + > +template<typename T> > +using B = A<__underlying_type(T) [[gnu::aligned(4)]]>; // { dg-warning > "ignoring attributes on template argument" } > + > +template<typename T> > +using B = A<__underlying_type(T) [[gnu::packed]]>; // { dg-warning "ignoring > attributes on template argument" } > > Marek