public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/113758] New: d: Callee destructor call invalidates the live object, not the temporary
@ 2024-02-04 20:53 ibuclaw at gdcproject dot org
2024-02-12 16:08 ` [Bug d/113758] " cvs-commit at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: ibuclaw at gdcproject dot org @ 2024-02-04 20:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113758
Bug ID: 113758
Summary: d: Callee destructor call invalidates the live object,
not the temporary
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: d
Assignee: ibuclaw at gdcproject dot org
Reporter: ibuclaw at gdcproject dot org
Target Milestone: ---
D ABI does callee destruction of arguments, which depends on the argument
already being copied to a temporary before passing by ref.
At some point, the front-end stopped explicitly generating this temporary, so
now the code generator must take care of it.
---
struct Sdtor
{
int field;
~this() { field = 0; }
}
void main()
{
auto var = Sdtor(1);
callee(var);
assert(var.field == 1); // fails.
}
void callee(Sdtor param) { }
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug d/113758] d: Callee destructor call invalidates the live object, not the temporary
2024-02-04 20:53 [Bug d/113758] New: d: Callee destructor call invalidates the live object, not the temporary ibuclaw at gdcproject dot org
@ 2024-02-12 16:08 ` cvs-commit at gcc dot gnu.org
2024-03-03 0:00 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-12 16:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113758
--- Comment #1 from GCC 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:3c57b1c12a8e34d50bdf6aaf44146760db6d1b33
commit r14-8933-g3c57b1c12a8e34d50bdf6aaf44146760db6d1b33
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug d/113758] d: Callee destructor call invalidates the live object, not the temporary
2024-02-04 20:53 [Bug d/113758] New: d: Callee destructor call invalidates the live object, not the temporary 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
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-03 0:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113758
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Iain Buclaw
<ibuclaw@gcc.gnu.org>:
https://gcc.gnu.org/g:e64fbf38e0b408696a97fbceb131ed1d19cbcd03
commit r13-8399-ge64fbf38e0b408696a97fbceb131ed1d19cbcd03
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)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug d/113758] d: Callee destructor call invalidates the live object, not the temporary
2024-02-04 20:53 [Bug d/113758] New: d: Callee destructor call invalidates the live object, not the temporary 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
2024-03-03 0:12 ` ibuclaw at gdcproject dot org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-03 0:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113758
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Iain Buclaw
<ibuclaw@gcc.gnu.org>:
https://gcc.gnu.org/g:e276a94c061861a09dd790d206ec73d90478925e
commit r12-10189-ge276a94c061861a09dd790d206ec73d90478925e
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)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug d/113758] d: Callee destructor call invalidates the live object, not the temporary
2024-02-04 20:53 [Bug d/113758] New: d: Callee destructor call invalidates the live object, not the temporary ibuclaw at gdcproject dot org
` (2 preceding siblings ...)
2024-03-03 0:04 ` cvs-commit at gcc dot gnu.org
@ 2024-03-03 0:09 ` cvs-commit at gcc dot gnu.org
2024-03-03 0:12 ` ibuclaw at gdcproject dot org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-03 0:09 UTC (permalink / raw)
To: gcc-bugs
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)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug d/113758] d: Callee destructor call invalidates the live object, not the temporary
2024-02-04 20:53 [Bug d/113758] New: d: Callee destructor call invalidates the live object, not the temporary ibuclaw at gdcproject dot org
` (3 preceding siblings ...)
2024-03-03 0:09 ` cvs-commit at gcc dot gnu.org
@ 2024-03-03 0:12 ` ibuclaw at gdcproject dot org
4 siblings, 0 replies; 6+ messages in thread
From: ibuclaw at gdcproject dot org @ 2024-03-03 0:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113758
Iain Buclaw <ibuclaw at gdcproject dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #5 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
Fixed and backported.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-03-03 0:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-04 20:53 [Bug d/113758] New: d: Callee destructor call invalidates the live object, not the temporary 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
2024-03-03 0:12 ` ibuclaw at gdcproject dot 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).