https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65752
--- Comment #2 from Robbert <gcc at robbertkrebbers dot nl> --- This example may seem academic, but there is a real problem underneath. Of course, I do agree that optimizations based on pointer origins are useful, but it is not an "all or nothing situation". As long as representations of pointers are kept opaque (i.e. the pointer has not been cast to an integer and the bit representation has not been inspected), I cannot think of any objection against such optimizations. They cannot affect the behavior of the code in any obvervable way. However, in case the representation of the pointer is made transparent, the programmer generally has a good reason for doing so. In such cases the compiler should not perform unexpected optimizations. Typical examples are: * Pointer tagging (using some bits of pointers representations to store additional information, for example for pointer hardening techniques or garbage collection). * Using of pointer representations as keys in hash tables. * Writing the representation of a chunk of memory containing pointers to memory.