https://issues.dlang.org/show_bug.cgi?id=23438
Issue ID: 23438 Summary: leaking address of stack Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: bugzi...@digitalmars.com As reported by Timon Gehr: int global; int* escaped; void qux()@safe{ int stack=1337; int* foo(return scope int* x)@safe{ int* bar(return scope int* y)@safe{ return x; } escaped=bar(&global); return x; } foo(&stack); } void main()@safe{ qux(); import std.stdio; version(THRASH_STACK) writeln("thrashing stack"); writeln(*escaped); } --