dip1000 + pure is a DEADLY COMBO

Dukc ajieskola at gmail.com
Thu May 13 14:23:13 UTC 2021


On Wednesday, 12 May 2021 at 13:14:30 UTC, Dennis wrote:
> **With `-preview=dip1000` enabled, the compiler will happily 
> compile valid, `@safe` D code into memory corrupting machine 
> code.**

This is indeed horrible. Thanks for bringing it up.

> Maybe the compiler can defensively heap-allocate for now, 
> though that would break `@nogc` code. Or maybe we can add 
> another switch, `-preview=dip1000proper`, since the fix is a 
> breaking change. What do you think?

The compiler switch, but with some changes:

- It would be inverse. Correct behaviour by default.
- You have to list modules/packages where the buggy behaviour 
would apply.
- One can set that flag to `core,std` to continue using Phobos 
with `-dip1000`, while still fixing the bug regarding user's own 
code.
- The error messages caused by the bug fix should clearly 
redirect to instructions to the above.


More information about the Digitalmars-d mailing list