[Bug middle-end/101586] ICE:in clear_padding_type, at gimple-fold.c:4783 with call to __builtin_clear_padding for C++

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jul 27 08:00:20 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101586

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:a21bd3cebd6f54af70a37c18b8fbeae933fb6515

commit r12-2522-ga21bd3cebd6f54af70a37c18b8fbeae933fb6515
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Jul 27 09:59:37 2021 +0200

    gimple-fold: Fix up __builtin_clear_padding on classes with virtual
inheritence [PR101586]

    For the following testcase, B is 16-byte type, containing 8-byte
    virtual pointer and 1-byte A member, and C contains two FIELD_DECLs,
    one with B type and size of just 8-byte and then a field with type
    A and 1-byte size.
    The __builtin_clear_padding code was upset about the B typed FIELD_DECL
    containing FIELD_DECLs beyond the field size and triggered
    assertion failure.
    This patch makes it ignore all FIELD_DECLs that are (fully) beyond the sz
    passed from the caller (except for the flexible array member
    diagnostics that is kept).

    2021-07-27  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/101586
            * gimple-fold.c (clear_padding_type): Ignore FIELD_DECLs with byte
            positions above or equal to sz except for diagnostics of flexible
            array members.

            * g++.dg/torture/builtin-clear-padding-4.C: New test.


More information about the Gcc-bugs mailing list