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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:953bbeaeff050f4d0b670568a587aa1ce82ed711

commit r14-1660-g953bbeaeff050f4d0b670568a587aa1ce82ed711
Author: Jason Merrill <ja...@redhat.com>
Date:   Fri Jun 9 10:37:35 2023 -0400

    c++: fix 32-bit spaceship failures [PR110185]

    Various spaceship tests failed after r14-1624.  This turned out to be
    because the comparison category classes return in memory on 32-bit targets,
    and the synthesized operator<=> looks something like

    if (auto v = a.x <=> b.x, v == 0); else return v;
    if (auto v = a.y <=> b.y, v == 0); else return v;
    etc.

    so check_return_expr was trying to do NRVO for all the 'v' variables, and
    now on subsequent returns we check to see if the previous NRV is still in
    scope.  But the NRVs didn't have names, so looking up name bindings
crashed.
    Fixed both by giving 'v' a name so we can NRVO the first one, and fixing
the
    test to give up if the old NRV has no name.

            PR c++/110185
            PR c++/58487

    gcc/cp/ChangeLog:

            * method.cc (build_comparison_op): Give retval a name.
            * typeck.cc (check_return_expr): Fix for nameless variables.

Reply via email to