https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103839
--- Comment #1 from Iain Buclaw <ibuclaw at gdcproject dot org> --- (In reply to Iain Buclaw from comment #0) > I can work around this by setting DECL_PADDING_P on all fields in unions > except the first. However I suspect this is a mistake, and the proper thing > to do would be to only consider the first field when clear padding a union. The fix to do this being a one-liner in gimple-fold.c diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 64515aabc04..9426e9ca473 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -4537,6 +4537,7 @@ clear_padding_union (clear_padding_struct *buf, tree type, clear_padding_type (union_buf, TREE_TYPE (field), fldsz, for_auto_init); clear_padding_add_padding (union_buf, sz - fldsz); clear_padding_flush (union_buf, true); + break; } if (buf == union_buf)