digitalmars.D.bugs - [Issue 20461] New: [dip1000] Passing stack allocated string to
- d-bugmail puremagic.com (25/25) Dec 21 2019 https://issues.dlang.org/show_bug.cgi?id=20461
https://issues.dlang.org/show_bug.cgi?id=20461 Issue ID: 20461 Summary: [dip1000] Passing stack allocated string to `assert` compiles Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: critical Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: doob me.com This code compiles with DMD 2.089.0 with the `-dip1000` flag: void main() safe { char[10] buffer = "0123456789"; assert(false, buffer[]); } Running this code will obviously assert, but the assert message contains garbage. The issue is that a stack allocated string has been passed to `assert` and the assertion message is printed after the stack of `main` is gone. DIP1000 should be able to catch this. --
Dec 21 2019