PR middle-end/79448 - unhelpful -Wformat-truncation=2 warning
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr79448-2.c
blobf75f523a2e0b7d65b61b15e34474a4e00f2e1b79
1 /* PR middle-end/79448 - unhelpful -Wformat-truncation=2 warning
2 Verify that there's no warning with optimization.
3 { dg-do compile }
4 { dg-options "-O2 -Wall -Wformat -Wformat-truncation=2" } */
6 typedef __SIZE_TYPE__ size_t;
8 extern int
9 snprintf (char*, size_t, const char*, ...);
11 char*
12 gettext (char*);
14 char*
15 fill (char *buf, size_t len, int count)
17 if (snprintf (buf, len, "%s: %d", gettext ("count"), count) >= len) /* { dg-bogus "directive output of 2 bytes causes result to exceed .INT_MAX." */
18 return 0;
20 return buf;