[Bug c++/102019] [12 Regression] UBSAN error: hwint.h:293:61: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int' since r12-2975-g32c3a75390623a0470df52af13f78baddd562981

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Aug 25 20:36:18 GMT 2021


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

--- Comment #2 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:1ab84eda5548119908c4e24c6ad953dd7c00a5b7

commit r12-3143-g1ab84eda5548119908c4e24c6ad953dd7c00a5b7
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Aug 25 22:35:21 2021 +0200

    c++: Fix up value initialization of structs with zero width bitfields
[PR102019]

    The removal of remove_zero_width_bit_fields, in addition to triggering
    some ABI issues that need solving anyway (ABI incompatibility between
    C and C++) also resulted in UB inside of gcc, we now call build_zero_init
    which calls build_int_cst on an integral type with TYPE_PRECISION of 0.

    Fixed by ignoring the zero width bitfields.  I understand
    build_value_init_noctor wants to initialize to 0 even unnamed bitfields
    (of non-zero width), at least until we have some CONSTRUCTOR flag that says
    that even all the padding bits should be cleared.

    2021-08-25  Jakub Jelinek  <jakub@redhat.com>

            PR c++/102019
            * init.c (build_value_init_noctor): Ignore unnamed zero-width
            bitfields.


More information about the Gcc-bugs mailing list