This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Wformat-security and string literal
* Joe Buck | 2005-10-17 09:28:51 [-0700]:
>If we go down that route, the option would only work correctly if
>optimization is enabled, because you expect gcc to trace the source
>of pointers, and see what the pointers point to, and check the original
>strings for format characters.
ACK - gcc behave correctly if optimization is enabled. To my mind: a
pointer who points to a string literal is also a string literal. The
generated string is stored in the .rodata section, on either side (-O0,
-O2). The generated code is the same, but the warning messages differ!
HGN