[Bug c/15698] [3.5 Regression] wrong error in presence of builtin fn + K&R declaration.

wilson at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Jun 1 02:00:00 GMT 2004


------- Additional Comments From wilson at gcc dot gnu dot org  2004-06-01 02:00 -------
The problem is the variable current_function_prototype_locus in c-decl.c.  It is
set conditionally, but then used unconditionally for error messages.  The result
is that if it wasn't set before it was used, then you get an old incorrect
value.  You can potentially get an uninitialized value if it was never set, but
since it is a global that just gives a value of zero.  In this case, when foobar
is redeclared, it is set to line 2, then when rindex is redeclared, it is not
set because rindex is a builtin, and then later we print line 2 as if that was
where rindex was first declared.  It should be cleared if we don't set it, or
alternately, it shouldn't be used if it wasn't set.

I can reproduce the same problem with exp.  You have to change the return type
to match, i.e. change both decls to use double instead of char *.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15698



More information about the Gcc-bugs mailing list