This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c/6547: misleading printf '$' format



>Number:         6547
>Category:       c
>Synopsis:       misleading printf '$' format
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 03 06:06:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Pierre PETIT
>Release:        gcc version 3.0.4 (and 2.95.4)
>Organization:
>Environment:
Debian GNU/Linux (testing) x86
Linux kernel 2.4.18 - libc v2.2.5
>Description:
Formats with '$' character get a warning on gcc-3.0,
when compiling with -Wall (or at least -Wformat):
"warning: unknown conversion type character '$' in format"

With both v2.95 and 3.0, there is a warning on "%.*1$s":
"warning: unknown conversion type character '1' in format"
>How-To-Repeat:
#include <stdio.h>

int main (int argc, char *argv[]) {
  printf("%.*s == %2$.*1$s\n", argc, *argv);
  return 0;
}
>Fix:

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]