https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110619
--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Fedor Chelnokov from comment #8) > This program must be rejected because of relational comparison of unrelated > pointers I disagree. If GCC were to define the behaviour of returning invalid pointers during constant evaluation as converting them to null pointers, then those wouldn't be unrelated pointers. They'd be null pointers. And the comparison would be well defined. But I don't think that conversion was ever intended as the defined behaviour, just an unintended consequence. If it was intended, it should have been documented at https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Implementation.html The fact that we _don't_ do any such conversion should also be documented there, of course. We should say that other uses of invalid pointers do not modify the pointer values, so copying them preserves the invalid value (without trapping, except on Itanium?) and pointer comparisons and pointer arithmetic are undefined because they don't point to an object.