[Issue 20461] New: [dip1000] Passing stack allocated string to `assert` compiles
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Dec 21 12:35:38 UTC 2019
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 at puremagic.com
Reporter: doob at 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.
--
More information about the Digitalmars-d-bugs
mailing list