public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/100882] New: ICE in gimplify_var_or_parm_decl, at gimplify.c:2755
@ 2021-06-02 18:57 ibuclaw at gdcproject dot org
  2021-06-04 18:49 ` [Bug d/100882] " cvs-commit at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ibuclaw at gdcproject dot org @ 2021-06-02 18:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100882
           Summary: ICE in gimplify_var_or_parm_decl, at gimplify.c:2755
           Product: gcc
           Version: 9.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: ibuclaw at gdcproject dot org
  Target Milestone: ---

Reduced test, adapted to make clear what the correct behaviour should be after
the ICE is fixed.
---
__gshared int counter = 0;
struct S
{
    this(int) { counter++; }
    ~this() { counter++; }
}

static S s;
static this()
{
    s = cast(shared) S(0);
    assert(counter == 2);
}
---

Reproducible from gdc-9 onwards.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug d/100882] ICE in gimplify_var_or_parm_decl, at gimplify.c:2755
  2021-06-02 18:57 [Bug d/100882] New: ICE in gimplify_var_or_parm_decl, at gimplify.c:2755 ibuclaw at gdcproject dot org
@ 2021-06-04 18:49 ` cvs-commit at gcc dot gnu.org
  2021-06-04 18:50 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-04 18:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain Buclaw <ibuclaw@gcc.gnu.org>:

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

commit r12-1225-gdf3fbd5957f12927a459a2686f4eee55f66ec2f4
Author: Iain Buclaw <ibuclaw@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/torture/pr100882.d: New test.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug d/100882] ICE in gimplify_var_or_parm_decl, at gimplify.c:2755
  2021-06-02 18:57 [Bug d/100882] New: ICE in gimplify_var_or_parm_decl, at gimplify.c:2755 ibuclaw at gdcproject dot org
  2021-06-04 18:49 ` [Bug d/100882] " cvs-commit at gcc dot gnu.org
@ 2021-06-04 18:50 ` cvs-commit at gcc dot gnu.org
  2021-06-04 18:50 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-04 18:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:83f932f23cae74344ec9e67c76faf2f014857992

commit r11-8512-g83f932f23cae74344ec9e67c76faf2f014857992
Author: Iain Buclaw <ibuclaw@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/torture/pr100882.d: New test.

    (cherry picked from commit e8761d4c21b5f4cc1c5612be9bf952a07c8a2238)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug d/100882] ICE in gimplify_var_or_parm_decl, at gimplify.c:2755
  2021-06-02 18:57 [Bug d/100882] New: ICE in gimplify_var_or_parm_decl, at gimplify.c:2755 ibuclaw at gdcproject dot org
  2021-06-04 18:49 ` [Bug d/100882] " cvs-commit at gcc dot gnu.org
  2021-06-04 18:50 ` cvs-commit at gcc dot gnu.org
@ 2021-06-04 18:50 ` cvs-commit at gcc dot gnu.org
  2021-06-04 18:51 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-04 18:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r10-9891-gdcc5cf980af747941b32fd16c1d6a07177a1a404
Author: Iain Buclaw <ibuclaw@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)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug d/100882] ICE in gimplify_var_or_parm_decl, at gimplify.c:2755
  2021-06-02 18:57 [Bug d/100882] New: ICE in gimplify_var_or_parm_decl, at gimplify.c:2755 ibuclaw at gdcproject dot org
                   ` (2 preceding siblings ...)
  2021-06-04 18:50 ` cvs-commit at gcc dot gnu.org
@ 2021-06-04 18:51 ` cvs-commit at gcc dot gnu.org
  2021-06-04 18:52 ` ibuclaw at gdcproject dot org
  2021-09-17  6:46 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-04 18:51 UTC (permalink / raw)
  To: gcc-bugs

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
<ibuclaw@gcc.gnu.org>:

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

commit r9-9569-gb81bb0a6025588ac752cd78cce74ecf0d9ab4494
Author: Iain Buclaw <ibuclaw@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)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug d/100882] ICE in gimplify_var_or_parm_decl, at gimplify.c:2755
  2021-06-02 18:57 [Bug d/100882] New: ICE in gimplify_var_or_parm_decl, at gimplify.c:2755 ibuclaw at gdcproject dot org
                   ` (3 preceding siblings ...)
  2021-06-04 18:51 ` cvs-commit at gcc dot gnu.org
@ 2021-06-04 18:52 ` ibuclaw at gdcproject dot org
  2021-09-17  6:46 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ibuclaw at gdcproject dot org @ 2021-06-04 18:52 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Buclaw <ibuclaw at gdcproject dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
Fix committed and backported.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug d/100882] ICE in gimplify_var_or_parm_decl, at gimplify.c:2755
  2021-06-02 18:57 [Bug d/100882] New: ICE in gimplify_var_or_parm_decl, at gimplify.c:2755 ibuclaw at gdcproject dot org
                   ` (4 preceding siblings ...)
  2021-06-04 18:52 ` ibuclaw at gdcproject dot org
@ 2021-09-17  6:46 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-17  6:46 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.5

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-17  6:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02 18:57 [Bug d/100882] New: ICE in gimplify_var_or_parm_decl, at gimplify.c:2755 ibuclaw at gdcproject dot org
2021-06-04 18:49 ` [Bug d/100882] " cvs-commit at gcc dot gnu.org
2021-06-04 18:50 ` cvs-commit at gcc dot gnu.org
2021-06-04 18:50 ` cvs-commit at gcc dot gnu.org
2021-06-04 18:51 ` cvs-commit at gcc dot gnu.org
2021-06-04 18:52 ` ibuclaw at gdcproject dot org
2021-09-17  6:46 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).