Bug 20803 – [REG2.071.0] Objects are destroyed too early with -inline

Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-05-08T00:11:17Z
Last change time
2024-12-13T19:08:25Z
Keywords
backend, wrong-code
Assigned to
No Owner
Creator
Vladimir Panteleev
Moved to GitHub: dmd#19699 →

Comments

Comment #0 by dlang-bugzilla — 2020-05-08T00:11:17Z
//////////////// test.d //////////////// struct V { bool alive = true; void checkAlive() { assert(alive); } } struct S { V v; @disable this(this); ~this() { v.alive = false; } } void main() { S().v.checkAlive(); } //////////////////////////////////////// Works fine without -inline, assert trips with -inline. This affects std.typecons.RefCounted. Because this bug causes it to return a dangling pointer into manually-allocated memory, it can cause memory corruption.
Comment #1 by dlang-bugzilla — 2020-05-08T00:19:05Z
Comment #2 by robert.schadek — 2024-12-13T19:08:25Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19699 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB