[Issue 22781] New: assert escapes reference to expired stack frame

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 16 18:50:12 UTC 2022


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: nobody at puremagic.com
          Reporter: snarwin+bugzilla at gmail.com

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:

---
core.exception.AssertError at bug.d(4): P�;�
----------------
??:? _d_assert_msg [0x55583733f7b0]
??:? _Dmain [0x55583733f724]
---

Instead of "oops", a corrupted message is printed.

--


More information about the Digitalmars-d-bugs mailing list