https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115527
--- Comment #4 from qinzhao at gcc dot gnu.org --- when checking the expanded IR for __builtin_clear_padding in the below: the builtin __builtin_clear_padding (&o, 0B); was expanded as the following sequence D.4430 = &o + 0; _2 = D.4430 + 72; goto <D.4432>; <D.4431>: MEM <char[7]> [(struct outer *)D.4430 + 9B] = {}; D.4430 = D.4430 + 24; <D.4432>: if (D.4430 != _2) goto <D.4431>; else goto <D.4433>; <D.4433>: MEM <char[4]> [(struct outer *)&o + 4B] = {}; When examining the above sequence, I locate the bug is at the last statement: MEM <char[4]> [(struct outer *)&o + 4B] = {}; this statement incorrectly zeroed the 5th to 8th bytes of the structure "o". Instead, it should zeroed the &o + 72 + 4B as: MEM <char[4]> [(struct outer *)&o + 72 + 4B] = {}; I will check why the expanding of __builtin_clear_padding is wrong.