------- Additional Comments From joseph at codesourcery dot com 2005-06-09 14:36 ------- Subject: Re: GCC should combine adjacent stdio calls
Another problem case is if the first format has excess arguments (which is permitted by ISO C) - those arguments must be evaluated but not included in the concatenated argument list. Even if arguments don't have side effects you have problems if arguments of the second printf might refer to anything modifed by printf (the FILE structure, its buffers, the contents of the file written to, ...) - they should have the appropriate values for after the first call. It's OK if the arguments are e.g. local integer variables whose addresses have not escaped, but in general you need to prove that the arguments to the second printf, and anything they point to, cannot be changed by the first printf. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21982