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

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


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

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

> Suppose an implementation defines e.g. clearerr as a macro, and the 
> expansion of that macro just clears bits in the stdio structure and 
> doesn't call any functions.  Then though the user's source code looks like 
> it contains a function call, after preprocessing it contains manipulation 
> of bits of the FILE structure for stdout instead.
> 
Ah, OK.  In which case, we should reset the "previous builtin" if
we find a store to global memory in between.  That'd be easy.

> (a) It could be stdio's buffer (via setvbuf).
> 
> (b) It could be a glibc memory stream opened with fmemopen (if the user 
> assigned to stdout - which glibc allows - or you do this optimization on 
> fprintf and not just printf).
> 
> (c) It could point to a memory mapping of the file being written.
> 
Gah, so we'll need to parse the format string then.  Oh, well.


Diego.


-- 


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



More information about the Gcc-bugs mailing list