[Issue 20809] New: return statement might access memory from destructed temporary
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri May 8 16:39:48 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20809
Issue ID: 20809
Summary: return statement might access memory from destructed
temporary
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dlang at foerdi.net
Hi,
See this reduced code: https://run.dlang.io/is/yoyHXC
I would expect that foo() returns 2.
My guess in foo is: The return value of val is saved locally as a ref int and
then the destructor of S is called (the local cache is pointing to 0). Now the
ref value is dereferenced and returned.
The last working version of dmd was 2.089
Maybe this issue is related to https://issues.dlang.org/show_bug.cgi?id=14696
(?)
- foerdi
--
More information about the Digitalmars-d-bugs
mailing list