[Bug tree-optimization/21982] GCC should combine adjacent stdio calls

dnovillo at redhat dot com gcc-bugzilla@gcc.gnu.org
Thu Jun 9 19:38:00 GMT 2005


------- Additional Comments From dnovillo at redhat dot com  2005-06-09 19:38 -------
Subject: Re:  GCC should combine adjacent stdio calls

On Thu, Jun 09, 2005 at 07:29:42PM -0000, joseph at codesourcery dot com wrote:

> Although it may not be valid to manipulate the FILE * directly, it seems 
> quite possible that a program might call another <stdio.h> function 
> between the printf calls
>
That is fine.  Any call between the two builtins blocks the
merging.

> that function on the particular implementation 
> having a macro expansion without a function call.
>
Sorry, you lost me here.

> It is also possible 
> that values of arguments to the second built-in printf call may depend on 
> the first one having been previously evaluated; for example, given
> 
> extern char *s;
> extern int i;
> 
> printf("%d", i);
> printf("%.5s", s);
> 
> you can't merge the printf calls because the first one could have changed 
> what is pointed to by s.
> 
How can printing an integer to stdout affect 's'?  Unless 's' has
been somehow mapped to stdout's buffer?  Is that what you have in
mind?


Diego.


-- 


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



More information about the Gcc-bugs mailing list