1 /* PR middle-end/77721 - -Wformat-overflow not uses arg range for converted vars
2 Test to verify that the correct range information is made available to the
3 -Wformat-lenght check to prevent warnings. */
4 /* { dg-do compile } */
5 /* { dg-options "-O2 -Wformat -Wformat-overflow -fdump-tree-optimized" } */
8 int snprintf (char*, __SIZE_TYPE__
, const char*, ...);
10 void fuchar (unsigned char j
, char *p
)
15 if (3 != snprintf (p
, 4, "%3hu", j
))
19 void fschar (signed char j
, char *p
)
21 const unsigned char k
= (unsigned char) j
;
26 if (3 != snprintf (p
, 4, "%3hhu", k
))
30 void fushrt (unsigned short j
, char *p
)
35 if (3 != snprintf (p
, 4, "%3hu", j
))
39 void fshrt (short j
, char *p
)
41 const unsigned short k
= (unsigned short) j
;
46 if (3 != snprintf (p
, 4, "%3hu", k
))
50 void fuint (unsigned j
, char *p
)
55 snprintf (p
, 4, "%3u", j
);
58 void fint (int j
, char *p
)
60 const unsigned k
= (unsigned) j
;
65 snprintf (p
, 4, "%3u", k
);
68 void fulong (unsigned long j
, char *p
)
73 snprintf (p
, 4, "%3lu", j
);
76 void flong (long j
, char *p
)
78 const unsigned long k
= (unsigned long) j
;
83 snprintf (p
, 4, "%3lu", k
);
86 void fullong (unsigned long long j
, char *p
)
91 snprintf (p
, 4, "%3llu", j
);
94 void fllong (long long j
, char *p
)
96 const unsigned long long k
= (unsigned long long) j
;
101 snprintf (p
, 4, "%3llu", k
);
104 /* { dg-final { scan-tree-dump-not "abort" "optimized" } } */