https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90472
--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> --- This is not a bug. If 'i' is not redeclared in an intermediate scope, so the visible declaration is one at file scope, the rule that "if the prior declaration specifies internal or external linkage, the linkage of the identifier at the later declaration is the same as the linkage specified at the prior declaration" applies, both declarations have internal linkage and the code is valid. If 'i' is redeclared in an intermediate scope with no linkage (function-local variable), the rule that "if the prior declaration specifies no linkage, then the identifier has external linkage" applies, which means that "If, within a translation unit, the same identifier appears with both internal and external linkage, the behavior is undefined." also applies, so a diagnostic is permitted (not required) as given by GCC. See C17 6.2.2. The reference given to 6.7p3 is irrelevant, since that's about declarations with no linkage in the same scope, and all declarations of 'i' are in different scopes.