You should probably disable such optimizations for @system code entirely. Not sure about @trusted, don't think it should apply there either. Having optimizations that allow for UB or crashing at runtime is not a good thing.