[Bug c/39044] -Wformat warns on printf() with stringpointer as sole argument

mano at roarinelk dot homelinux dot net gcc-bugzilla@gcc.gnu.org
Sat Jan 31 06:14:00 GMT 2009



------- Comment #2 from mano at roarinelk dot homelinux dot net  2009-01-31 06:14 -------
(In reply to comment #1)
> GNU C (GCC) version 4.3.3 20081218 (prerelease) [gcc-4_3-branch revision
> 142804] (i386-apple-darwin8.11.1)
> 
> 
> Did you modify GCC at all?

Ah, you're right. Gentoo enables -Wformat-security by default now. I'll bug
them about this.

On the other hand, this does not generate a warning. Why?

---- 8< ------- 8< --------
#include <stdio.h>
int main()
{
  static const char *s = "hello", *t = " world";

  printf(s, t);
  return 0;
}

----- 8< ------ 8< ---------


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39044



More information about the Gcc-bugs mailing list