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

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

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

commit r9-9569-gb81bb0a6025588ac752cd78cce74ecf0d9ab4494
Author: Iain Buclaw <ibuc...@gdcproject.org>
Date:   Fri Jun 4 19:38:26 2021 +0200

    d: Fix ICE in gimplify_var_or_parm_decl, at gimplify.c:2755 (PR100882)

    Constructor calls for temporaries were reusing the TARGET_EXPR_SLOT of a
    TARGET_EXPR for an assignment, which later got passed to `build_assign',
    which stripped away the outer TARGET_EXPR, leaving a reference to a lone
    temporary with no declaration.

    This stripping away of the TARGET_EXPR also discarded any cleanups that
    may have been assigned to the expression as well.

    So now the reuse of TARGET_EXPR_SLOT has been removed, and
    `build_assign' now constructs assignments inside the TARGET_EXPR_INITIAL
    slot.  This has also been extended to `return_expr', to deal with
    possibility of a TARGET_EXPR being returned.

    gcc/d/ChangeLog:

            PR d/100882
            * d-codegen.cc (build_assign): Construct initializations inside
            TARGET_EXPR_INITIAL.
            (compound_expr): Remove intermediate expressions that have no
            side-effects.
            (return_expr): Construct returns inside TARGET_EXPR_INITIAL.
            * expr.cc (ExprVisitor::visit (CallExp *)): Remove useless
assignment
            to TARGET_EXPR_SLOT.

    gcc/testsuite/ChangeLog:

            PR d/100882
            * gdc.dg/pr100882a.d: New test.
            * gdc.dg/pr100882b.d: New test.
            * gdc.dg/pr100882c.d: New test.
            * gdc.dg/pr100882d.d: New test.

    (cherry picked from commit e8761d4c21b5f4cc1c5612be9bf952a07c8a2238)

Reply via email to