https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43565
--- Comment #7 from Marc Nieper-Wißkirchen <m...@nieper-wisskirchen.de> --- I'm sorry, I wasn't precise what I meant. When I wrote that the optimization wouldn't be possible I meant the case of two externally defined variables, e.g. extern int p; extern int q; One can force the optimization by inserting if (&p == &q) __builtin_unreachable (); in critical code paths but this is just a very local and not a general resolution. If p and q could resolve to the same address after linking (which is outside of what GCC sees) but the user knows that it does not, my idea was to allow something like extern int __attribute__ (( never_alias )) p; extern int __attribute__ (( never_alias )) q; to give the compiler a global hint.