[Issue 23438] New: leaking address of stack
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 26 18:40:20 UTC 2022
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: nobody at puremagic.com
Reporter: bugzilla at 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);
}
--
More information about the Digitalmars-d-bugs
mailing list