1 /* PR middle-end/79448 - unhelpful -Wformat-truncation=2 warning
2 Verify that there's no warning without optimization.
3 { dg-do compile }
4 { dg-options "-Wall -Wformat -Wformat-truncation=2" } */
5
6 typedef __SIZE_TYPE__ size_t;
7
8 extern int
9 snprintf (char*, size_t, const char*, ...);
10
11 char*
12 gettext (char*);
13
14 char*
fill(char * buf,size_t len,int count)15 fill (char *buf, size_t len, int count)
16 {
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;
19
20 return buf;
21 }
22