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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #39 from Martin Sebor <msebor at gcc dot gnu.org> ---
I don't know what happened to the patch but since it was posted a printf
optimization and warning pass has been added to GCC that deals with a small
subset of the issues raised here (e.g., it has its own format string parser and
detects its own set of printf problems).

I think merging only printf calls that are adjacent in GIMPLE with no
intervening assignments to subsequent printf arguments from variables that may
have escaped would obviate the problems raised in comment #18 and comment #29. 
I don't have a sense how much that would impact the optimization.

FWIW, I think a more interesting and more widely applicable optimization
opportunity than merging printf calls is in transforming sprintf and especially
snprintf calls with format strings containing multiple %s directives (and no
others) into sequences of strcpy/memcpy/memccpy calls (pr88813).

Reply via email to