Bug 24694 – [DIP1000] can escape stack pointer through struct.class.field

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-08-03T19:47:59Z
Last change time
2024-08-04T00:27:34Z
Keywords
pull, safe
Assigned to
No Owner
Creator
Dennis

Comments

Comment #0 by dkorpel — 2024-08-03T19:47:59Z
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; } ```
Comment #1 by dlang-bot — 2024-08-03T19:58:11Z
@dkorpel created dlang/dmd pull request #16768 "Fix bugzilla 24694 - [DIP1000] can escape stack pointer through struc…" fixing this issue: - Fix bugzilla 24694 - [DIP1000] can escape stack pointer through struct.class.field https://github.com/dlang/dmd/pull/16768
Comment #2 by dlang-bot — 2024-08-04T00:27:34Z
dlang/dmd pull request #16768 "Fix bugzilla 24694 - [DIP1000] can escape stack pointer through struc…" was merged into master: - 7e1c798ab2406eeac7278f2f30949acfeb8b761a by Dennis Korpel: Fix bugzilla 24694 - [DIP1000] can escape stack pointer through struct.class.field https://github.com/dlang/dmd/pull/16768