c/1027: slightly misleading printf format warning

cwitty@newtonlabs.com cwitty@newtonlabs.com
Sat Dec 9 17:46:00 GMT 2000


>Number:         1027
>Category:       c
>Synopsis:       slightly misleading printf format warning
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 09 17:46:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Carl Witty
>Release:        gcc version 2.7.2.3 (also with Code Sourcery compilation server as of 20001209)
>Organization:
>Environment:
Debian GNU/Linux (slink); x86
>Description:
When you compile the following code with -c -O -Wall -g,
the warning messages include:
7: warning: char format, double arg (arg 2)
for the line
printf("%s", &d);
I find this warning misleading; I would prefer:
warning: char* format, double* arg (arg 2)
>How-To-Repeat:
#include <stdio.h>

void foo() {
  double d;

  printf("%c", d);
  printf("%s", &d);
  printf("%c", &d);
  printf("%s", d);
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Gcc-prs mailing list