[Patch]: fix PR middle-end/25022 failure to transform the unlocked stdio calls

Roger Sayle roger@eyesopen.com
Fri Nov 25 16:47:00 GMT 2005


On Fri, 25 Nov 2005, Kaveh R. Ghazi wrote:
> > 2005-11-24  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
> >
> > 	    PR middle-end/25022
> > 	    * builtins.c (expand_builtin_printf,
> > 	    expand_builtin_fprintf,
> > 	    fold_builtin_fputs, fold_builtin_printf,
> > 	    fold_builtin_fprintf):
> > 	    Lookup the explicit replacement functions for any unlocked
> > 	    stdio builtin transformations.
> >
> > testsuite:
> > 	* gcc.c-torture/execute/builtins/fprintf.c,
> > 	gcc.c-torture/execute/builtins/fputs-lib.c,
> > 	gcc.c-torture/execute/builtins/fputs.c,
> > 	gcc.c-torture/execute/builtins/lib/fprintf.c,
> > 	gcc.c-torture/execute/builtins/lib/printf.c,
> > 	gcc.c-torture/execute/builtins/printf.c: Test the unlocked style.
>
> Okay for mainline and 4.1?

This is OK for mainline and 4.1.  Thanks especially for adding the
comments explaining why we're allowed to use built_in_decls in these
exceptional cases.

A slightly more general fix to this problem might be to populate
implicit_builtin_decls from builtin_decls whenever an "extension"
function is encountered in the source code.  So if a user ever
explicitly calls function "foo", the compiler can thereafter assume
"foo" is available for optimization purposes.  Potential problems
can be mitigated by "-fno-builtin-foo".  Just a thought, and certainly
not a suitable fix for the 3.4, 4.0 and 4.1 regressions.

Roger
--



More information about the Gcc-patches mailing list