[Bug middle-end/17402] static functions are removed before builtins are expanded

jsm at polyomino dot org dot uk gcc-bugzilla@gcc.gnu.org
Sun Oct 3 19:19:00 GMT 2004


------- Additional Comments From jsm at polyomino dot org dot uk  2004-10-03 19:19 -------
Subject: Re:  static functions are removed before
 builtins are expanded

On Sun, 3 Oct 2004, phython at gcc dot gnu dot org wrote:

>  Ok, so I took a look at this on mainline.  What happens is sprintf is folded
> into __builtin_strcpy.  All the tree optimizers run, strcpy is removed and a
> call to __builtin_strcpy is still around.

It would in fact be *wrong* ever to generate a call to a static definition 
of strcpy in such a case; even if the local static strcpy weren't removed, 
calling it rather than the external strcpy from sprintf is wrong.  Though 
strcpy is reserved with external linkage, it is only reserved at file 
scope (e.g. as a static function) if <string.h> is included.  If built-in 
function calls can generate calls to file-scope statics, then that is a 
bug.



-- 


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



More information about the Gcc-bugs mailing list