[Bug c++/98463] [11 Regression] internal compiler error: in output_constructor_regular_field, at varasm.c:5491 by r11-2720

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jan 29 16:00:50 GMT 2021


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

--- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:2127d2c3ee23bbd03f02d88fd82403408696ee4a

commit r10-9314-g2127d2c3ee23bbd03f02d88fd82403408696ee4a
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Jan 22 13:17:10 2021 -0500

    c++: [[no_unique_address]] in empty base [PR98463]

    In this testcase, cxx_eval_store_expression got confused trying to build up
    CONSTRUCTORs for initializing a subobject because the subobject is a member
    of an empty base.  In C++14 mode and below we don't build FIELD_DECLs for
    empty bases, so the CONSTRUCTOR skipped the empty base, and treated the
    member as a member of the derived class, which breaks.

    Fixed by recognizing this situation and giving up on trying to build a
    CONSTRUCTOR for the inner target at that point; since it doesn't have any
    data, we don't need to actually store anything.

    gcc/cp/ChangeLog:

            PR c++/98463
            * constexpr.c (get_or_insert_ctor_field): Add check.
            (cxx_eval_store_expression): Handle discontinuity of refs.

    gcc/testsuite/ChangeLog:

            PR c++/98463
            * g++.dg/cpp2a/no_unique_address8.C: New test.


More information about the Gcc-bugs mailing list