https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101586
--- Comment #7 from Qing Zhao <qing.zhao at oracle dot com> --- > On Jul 23, 2021, at 10:10 AM, jakub at gcc dot gnu.org > <gcc-bugzi...@gcc.gnu.org> wrote: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101586 > > --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > It is related to the weird FIELD_DECLs the C++ FE creates for the virtual > inheritence, there is e.g. a FIELD_DECL with B type (where B has 16 byte size > and includes the 8 byte virtual pointer and 1 byte A), but the size of the > FIELD_DECL is just 8 bytes, which is something the clear padding code didn't > expect to see. So, is such type information generated by C++FE correct? > > 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?)