1 /* PR tree-optimization/87034 - missing -Wformat-overflow on a sprintf
2 %s with a wide string. */
3 /* { dg-do compile } */
4 /* { dg-require-effective-target 4byte_wchar_t } */
5 /* { dg-options "-O2 -Wall -Wformat-overflow -ftrack-macro-expansion=0" } */
7 typedef __WCHAR_TYPE__
wchar_t;
9 extern int sprintf (char*, const char*, ...);
17 void test (struct S
*p
)
19 const char *q
= sizeof (wchar_t) == 2
20 ? (char*)L
"\x4142\x4344" : (char*)L
"\x41424344\x45464748";
22 sprintf (p
->a
, "%s", q
); /* { dg-warning "\\\[-Wformat-overflow" "pr87034" { xfail *-*-*} } */