2018-06-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / c-c++-common / Wformat-pr84258.c
blobd2870a887019394060bcb04c5047e1ca68d41da2
1 /* { dg-options "-Wformat" } */
3 int main (int argc, char **argv)
5 char buf[10];
7 char c[] = "%i";
8 unsigned char uc[] = "%i";
9 const char cc[] = "%i";
10 const unsigned char cuc[] = "%i";
12 __builtin_sprintf(buf, (char *)c, 1);
13 __builtin_sprintf(buf, (char *)uc, 1);
14 __builtin_sprintf(buf, (char *)cc, 1);
15 __builtin_sprintf(buf, (char *)cuc, 1); /* { dg-warning "format string is not an array of type 'char'" } */
16 __builtin_sprintf(buf, (const char *)L"foo"); /* { dg-warning "format is a wide character string" } */
18 return 0;