Hi, this patch fixes type inconsistency in between main variant and its variant. This is caused by build_cplus_array_type first laying down the type and only then linking it into vairant chain.
Bootstrapped/regtested x86_64-linux, OK? Honza PR tree-optimization/62053 * tree.c (build_cplus_array_type): Layout type after variants are set. Index: tree.c =================================================================== --- tree.c (revision 216141) +++ tree.c (working copy) @@ -863,12 +863,12 @@ build_cplus_array_type (tree elt_type, t { t = build_min_array_type (elt_type, index_type); set_array_type_canon (t, elt_type, index_type); - if (!dependent) - layout_type (t); TYPE_MAIN_VARIANT (t) = m; TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m); TYPE_NEXT_VARIANT (m) = t; + if (!dependent) + layout_type (t); } }