https://issues.dlang.org/show_bug.cgi?id=22781
Issue ID: 22781
Summary: assert escapes reference to expired stack frame
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
As of DMD 2.098.1, the following program compiles, runs, and exhibits undefined
behavior:
---
void main() @safe
{
char[4] message = "oops";
assert(0, message[]);
}
---
Example output:
---
[email protected](4): P�;�
----------------
??:? _d_assert_msg [0x55583733f7b0]
??:? _Dmain [0x55583733f724]
---
Instead of "oops", a corrupted message is printed.
--