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

--- Comment #19 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:8618aed89650bbeec450191aecab3037124851b1

commit r12-9543-g8618aed89650bbeec450191aecab3037124851b1
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Wed May 17 10:15:50 2023 +0200

    c++: Don't try to initialize zero width bitfields in zero initialization
[PR109868]

    My GCC 12 change to avoid removing zero-sized bitfields as they are
    important for ABI and are needed for layout compatibility traits
    apparently causes zero sized bitfields to be initialized in the IL,
    which at least in 13+ results in ICEs in the ranger which is upset
    about zero precision types.

    I think we could even avoid initializing other unnamed bitfields, but
    unfortunately !CONSTRUCTOR_NO_CLEARING doesn't mean in the middle-end
    clearing of padding bits and until we have some new flag that represents
    the request to clear padding bits, I think it is better to keep zeroing
    non-zero sized unnamed bitfields.

    In addition to skipping those fields, I have changed the logic how
    UNION_TYPEs are handled, the current code was a little bit weird in that
    e.g. if first non-static data member had error_mark_node type, we'd happily
    zero initialize the second non-static data member, etc.

    2023-05-17  Jakub Jelinek  <ja...@redhat.com>

            PR c++/109868
            * init.cc (build_zero_init_1): Don't initialize zero-width
bitfields.
            For unions only initialize the first FIELD_DECL.

            * g++.dg/init/pr109868.C: New test.

    (cherry picked from commit 78327cf06e6b65fc9c614622c98f6a3f3bfb7784)

Reply via email to