[Bug c/84258] New: Bogus -Wformat warning "wide character string" for const unsigned char
w.steinwender at freenet dot de
gcc-bugzilla@gcc.gnu.org
Wed Feb 7 09:13:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84258
Bug ID: 84258
Summary: Bogus -Wformat warning "wide character string" for
const unsigned char
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: w.steinwender at freenet dot de
Target Milestone: ---
#include <stdio.h>
int main(int argc, char **argv ) {
char buf[10];
char c[] = "%i";
unsigned char uc[] = "%i";
const char cc[] = "%i";
const unsigned char cuc[] = "%i";
sprintf(buf, (char *)c, 1);
sprintf(buf, (char *)uc, 1);
sprintf(buf, (char *)cc, 1);
sprintf(buf, (char *)cuc, 1);
return 0;
}
gcc-5 -Wformat test.c
test.c: In function ‘main’:
test.c:15:26: warning: format is a wide character string [-Wformat=]
sprintf(buf, (char *)cuc, 1);
The warning does not make sense to me.
Tested with 4.3.2 and 5.4.0.
More information about the Gcc-bugs
mailing list