public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug d/113758] d: Callee destructor call invalidates the live object, not the temporary
Date: Sun, 03 Mar 2024 00:09:06 +0000	[thread overview]
Message-ID: <bug-113758-4-bHB1zx5unC@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113758-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from GCC 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:8ceb48b1f8ebb9957d896082b0b503cf7f81cace

commit r11-11264-g8ceb48b1f8ebb9957d896082b0b503cf7f81cace
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Sun Feb 4 22:04:14 2024 +0100

    d: Fix callee destructor call invalidates the live object [PR113758]

    When generating the argument, check the isCalleeDestroyingArgs hook, and
    force a TARGET_EXPR to be created if true, so that a reference to the
    live object isn't passed directly to the function that runs dtors.

    When instead dealing with caller running destructors, two temporaries
    were being generated, one explicit temporary generated by the D
    front-end, and another implicitly by the code generator.  This has been
    reduced to one by setting DECL_VALUE_EXPR on the explicit temporary to
    bind it to the implicit slot created for the TARGET_EXPR, as that has
    the shorter lifetime of the two.

            PR d/113758

    gcc/d/ChangeLog:

            * d-codegen.cc (d_build_call): Force a TARGET_EXPR when callee
            destorys its arguments.
            * decl.cc (DeclVisitor::visit (VarDeclaration *)): Set
            SET_DECL_VALUE_EXPR on the temporary variable to make it a
placeholder
            for the TARGET_EXPR_SLOT.

    gcc/testsuite/ChangeLog:

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

    (cherry picked from commit 3c57b1c12a8e34d50bdf6aaf44146760db6d1b33)

  parent reply	other threads:[~2024-03-03  0:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-04 20:53 [Bug d/113758] New: " ibuclaw at gdcproject dot org
2024-02-12 16:08 ` [Bug d/113758] " cvs-commit at gcc dot gnu.org
2024-03-03  0:00 ` cvs-commit at gcc dot gnu.org
2024-03-03  0:04 ` cvs-commit at gcc dot gnu.org
2024-03-03  0:09 ` cvs-commit at gcc dot gnu.org [this message]
2024-03-03  0:12 ` ibuclaw at gdcproject dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-113758-4-bHB1zx5unC@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).