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.
Comment #1 by dlang-bot — 2020-03-20T07:56:20Z
@WalterBright created dlang/dmd pull request #10947 "fix Issue 20461 - [dip1000] Passing stack allocated string to assert …" fixing this issue:
- fix Issue 20461 - [dip1000] Passing stack allocated string to assert compiles
https://github.com/dlang/dmd/pull/10947
Comment #2 by dlang-bot — 2020-03-27T03:22:12Z
dlang/dmd pull request #10947 "fix Issue 20461 - [dip1000] Passing stack allocated string to assert …" was merged into master:
- a3207884443060f7c9724449b2b7eb33a2d5316c by Walter Bright:
fix Issue 20461 - [dip1000] Passing stack allocated string to assert compiles
https://github.com/dlang/dmd/pull/10947