https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108506
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
Internals of what is going on:
Gimple IR
bad (__builtin_bit_cast):
MEM[(struct Foo *)output_7(D) + ivtmp.13_20 * 1] = VIEW_CONVERT_EXPR<struct
Foo>(_1);
vs good (memcpy):
MEM <vector(32) unsigned char> [(char * {ref-all})output_7(D) + ivtmp.28_20 *
1] = _1;
Both look ok really. Though the first one could be rewritten into the second
one which would fix the expansion. Though maybe it could be fixed in the
middle-end while doing the expansion of gimple to RTL.