https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101586
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Qing Zhao from comment #7) > So, is such type information generated by C++FE correct? Yes. It is needed that way to follow the Itanium C++ ABI. > > BTW, if you are using the clear padding code for -ftrivial*, unless it is > > clear_type_padding_in_mask, it can error e.g. on flexible array members, > > which > > is fine for the builtin, but probably not fine for -ftrivial*. > > I noticed this, and then I fixed this by adding a third argument for > __builtin_clear_padding to indicate whether it’s for auto init or not. > If for auto init, then not emit the error, is this fix good? > > (BTW, what’s clear_type_padding_in_mask try to do? Should I use it instead?) I'd need to see a patch. The builtin itself has a single argument and shouldn't accept more than one, gimple_fold_builtin_clear_padding has also just a single argument. clear_type_padding_in_mask doesn't emit code to clear any memory, but fills in an array with bitmask which bits contain padding and which don't.