https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112826
Xi Ruoyao <xry111 at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED CC| |xry111 at gcc dot gnu.org --- Comment #2 from Xi Ruoyao <xry111 at gcc dot gnu.org> --- N1570 6.9 p2: "If an identifier declared with external linkage is used in an expression (other than as part of the operand of a sizeof or _Alignof operator whose result is an integer constant), somewhere in the entire program there shall be exactly one external definition for the identifier" and annex J.2 explicitly lists "An identifier with external linkage is used, but in the program there does not exist exactly one external definition for the identifier" as undefined behavior. Note that you cannot interpret "used" as "really executed at runtime" because it's impossible to solve halting problem, so such an "interpretation" will render the entire standard nonsense.