This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/21982] GCC should combine adjacent stdio calls
- From: "dnovillo at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jun 2005 19:57:44 -0000
- Subject: [Bug tree-optimization/21982] GCC should combine adjacent stdio calls
- References: <20050609125653.21982.ghazi@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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