[Issue 24694] New: [DIP1000] can escape stack pointer through struct.class.field
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Aug 3 19:47:59 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24694
Issue ID: 24694
Summary: [DIP1000] can escape stack pointer through
struct.class.field
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: safe
Severity: normal
Priority: P3
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dkorpel at live.nl
This @safe function returns a dangling stack pointer:
```D
class C
{
int* p;
}
struct S
{
C c;
}
int* escape() @safe
{
int x = 0;
S b = S(new C());
b.c.p = &x;
return b.c.p;
}
```
--
More information about the Digitalmars-d-bugs
mailing list