[test]$ cat bar.c #include <stdio.h> const char s[1] = "s"; int main (void) { printf (s); return 0; } [test]$ gcc-svn -v Using built-in specs. Target: i686-linux-gnu Configured with: ../gcc.orig/configure --prefix=/home/dsh --program-suffix=-svn --build=i686-linux-gnu --enable-languages=all Thread model: posix gcc version 4.3.0 20070731 (experimental) [test]$ gcc-svn -std=gnu99 -Wformat=2 bar.c bar.c: In function 'main': bar.c:6: warning: zero-length printf format string
The format string is not zero-length, it's unterminated. The fix is simple. I've got a patch and will send it in shortly. -- Summary: -Wformat warns incorrectly on an unterminated format string of length 1 Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dsh at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32953