// Test that auto-generated field constructors for unions with array // first members compile correctly. // // The bug: for `union U { char data[64]; ... }`, the auto-generated // field constructor does `__builtin_memcpy(&dst, &src, sizeof(char[64]))`. // But `char src[64]` decays to `char *` (8 bytes) as a parameter, // so `&src` points to the 8-byte pointer, not the 64-byte array. // // The field constructor cannot be called from CFA code (the resolver // cannot match array parameters after decay), so this bug is only // caught at compile time: with cfa_linkonce, the field constructor has // external linkage and __attribute__((used)), forcing GCC to compile // it and flag the bad memcpy via -Wstringop-overread. union ArrayUnion { char data[64]; long align; }; int main() { ArrayUnion u; (void)u; printf( "passed\n" ); }