https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102586
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org, | |ppalka at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, seems the C9 type is 32-byte, with 8-byte virtual table pointers at offset 0 and 16 bytes (and the rest is padding), C5 is 24-byte with virtual table pointers at offsets 0 and 8 bytes (and the rest is padding), C4 is 16-byte with virtual table pointers at offset 0 (and the rest is padding). But what the middle-end sees is that there is a FIELD_DECL with C5 type at offset 0 with size 9 bytes and then a FIELD_DECL with C4 type at offset 16 with size 9 bytes. The __builtin_clear_padding handling code when called on a FIELD_DECL with smaller DECL_SIZE_UNIT than TYPE_SIZE_UNIT is able to ignore fields that are wholy beyond the size and also the default behavior is that everything is padding until proven otherwise, so for padding bytes nothing changes. The reason for the ICE is that the first FIELD_DECL with C5 type says 9 bytes and the type has 8 byte, 8 byte and 1 byte fields (2 virtual table pointers and one padding byte). So, in that case it is unclear what the code should do. Shall it treat the fields that partially fall into the range and partially don't as padding (ignore them), or is there no way to do this using the TREE_TYPE of FIELD_DECLs that the middle-end sees and one needs to use some other types (I vaguely remember the C++ FE has some variant RECORD_TYPEs for the virtual bases that actually reflect what is present and where, but I have no idea if that is visible to the middle-end somewhere)?