[Bug c/79554] Zero length format string passed to fprintf under if statement causes error message

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 16 15:31:00 GMT 2017


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
In the first macro fmt_ isn't defined at all (nor there is a fmt_ variable), so
I doubt it compiles at all.
And, in the second macro, the warning is 100% correct, fmt_ is a non-const
variable, -Wformat-security is a FE warning, so can't rely on any optimizations
etc.  Probably const char *const fmt_ = fmt; should work, because then it
should be able to look at the var's initializer.


More information about the Gcc-bugs mailing list