The machinery that computes the layout of derived types does not support
C-compatible unchecked union types, but their layout is fixed in any case.
gcc/ada/ChangeLog:
* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Record_Type>: Do not
derive the layout of C-compatible unchecked union types.
}
/* If this is a derived type with discriminants and these discriminants
- affect the initial shape it has inherited, factor them in. */
- if (has_discr
+ affect the initial shape it has inherited, factor them in, but this
+ is not needed for a C-compatible Unchecked_Union since the variants
+ are at offset 0 in there. */
+ if (TREE_CODE (gnu_type) == RECORD_TYPE
+ && has_discr
&& !is_extension
&& !Has_Record_Rep_Clause (gnat_entity)
&& Stored_Constraint (gnat_entity) != No_Elist