And you might want to access a memory location legitimately that was not written by this program, for instance a chunk of dual-port memory, a shared memory block, a piece of memory mapped hardware and so on.
In those cases some compiler override could provide the solution, while still allowing the compiler to flag all the other cases as errors.
Your examples are not expected to work unless you specifically ask the compiler for it.
If you use the volatile key word, then you are guaranteed that all reads and stores will actually happen and not be optimized out. But volatile still allows non-atomicity and reordering so you probably want something which prohibits that too.
In those cases some compiler override could provide the solution, while still allowing the compiler to flag all the other cases as errors.