Missed printf warning (%d given char)

JDonner jdonner@schedsys.com
Thu Sep 9 08:55:00 GMT 1999


2.95.1 (1990816) fails to detect that a %d is given a char;
I don't know whether this is deliberate or not.

#include <stdio.h>

int main()
{
  const char blah[] = "abcdefgh";

  printf("%d\n", blah[5]);
  return 0;
}

gcc -Wall foo.cpp

Compilation finished at Thu Sep  9 11:43:20

Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/specs
gcc version 2.95.1 19990816 (release)


More information about the Gcc-bugs mailing list