As of DMD 2.095.0, the following program compiles and exhibits undefined behavior at runtime: --- int* p = cast(int*) 0xDEADBEEF; void main() @safe { int n = *p; } --- To prevent this, the compiler must forbid access to global variables in @safe code unless it can prove that they have safe values. [1] [1] https://dlang.org/spec/function.html#safe-values
*** This issue has been marked as a duplicate of issue 19646 ***