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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Iain Buclaw
<ibuc...@gcc.gnu.org>:

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

commit r11-8686-gf67d7f9416be37c34c4188866fb3d10c1dbc7a2a
Author: Iain Buclaw <ibuc...@gdcproject.org>
Date:   Sat Jul 3 00:13:29 2021 +0200

    d: RHS value lost when a target_expr modifies LHS in a cond_expr

    To prevent the RHS of an assignment modifying the LHS before the
    assignment proper, a target_expr is forced so that function calls that
    return with slot optimization modify the temporary instead.  This did
    not work for conditional expressions however, to give one example.  So
    now the RHS is always forced to a temporary.

            PR d/101282

    gcc/d/ChangeLog:

            * d-codegen.cc (build_assign): Force target_expr on RHS for non-POD
            assignment expressions.

    gcc/testsuite/ChangeLog:

            * gdc.dg/torture/pr101282.d: New test.

    (cherry picked from commit c77230856eac2d28eb7bf10985846885c3c8727b)

Reply via email to