https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67386

--- Comment #4 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
On Fri, 28 Aug 2015, msebor at gcc dot gnu.org wrote:

> My reading was that the implicit declaration is intended to be in effect only
> for the call to the otherwise undeclared function, but GCC and the other
> compilers I've tried let it persist (at least) until the end of the scope and

Yes (remember, two scopes are the same if they end at the same point; 
saying what block the declaration appears in is the same as saying where 
it ends).

> I think Clang and IBM xlc are both wrong since the reference to abs on line 8
> should clearly be diagnosed.  The C90 words aren't completely clear about 
> where
> in the innermost block the extern int identifier(); declaration is supposed to
> appear but it stands to reason that it should appear where all other
> declarations must appear in C90: before any executable code.  So diagnosing 
> the

In general, it's a mistake to interpret "X is equivalent to Y" statements 
in the C standard as referring to a textual substitution; there are plenty 
of other places where applying such a substitution goes wrong.  Cf. cases 
where something is said to be equivalent to a particular sequence of 
declarations and statements and it must be implicitly understood that the 
variable names in those declarations and statements are not special in any 
way.

Reply via email to