Hi, this patch avoids the attempt to create user-aligned-type for variants original and main-variants type-alignment differ and original type isn't user-aligned. Not sure if this is the preferred variant, we could create for such cases an aligned-type without setting user-align. But as this should just happen for invalid types, I am not sure if we actual need to handle later at all. So I suggest the following fix for it:
ChangeLog PR c++/65390 * tree.c (strip_typedefs): Don't attempt to build user-aligned type if original doesn't set it and main-variant differs to it. Jonathan is just about to reduce the testcase, so final patch should include reduced testcase for it. Regression-tested for x86_64-unknown-linux-gnu. Ok for apply? Regards, Kai Index: tree.c =================================================================== --- tree.c (Revision 221277) +++ tree.c (Arbeitskopie) @@ -1356,7 +1356,7 @@ strip_typedefs (tree t) if (!result) result = TYPE_MAIN_VARIANT (t); if (TYPE_USER_ALIGN (t) != TYPE_USER_ALIGN (result) - || TYPE_ALIGN (t) != TYPE_ALIGN (result)) + || (TYPE_USER_ALIGN (t) && TYPE_ALIGN (t) != TYPE_ALIGN (result))) { gcc_assert (TYPE_USER_ALIGN (t)); if (TYPE_ALIGN (t) == TYPE_ALIGN (result))