Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / builtin-sprintf-warn-17.c
blob27aa83983411d57cd067aae2552348b304869395
1 /* PR tree-optimization/80497 - ICE at -O1 and above on valid code on
2 x86_64-linux-gnu in "tree_to_uhwi"
3 { dg-do compile }
4 { dg-options "-O2 -Wall -Wformat-overflow" }
5 { dg-require-effective-target int128 } */
7 extern char buf[];
9 const __int128_t sint128_max
10 = (__int128_t)1 << (sizeof sint128_max * __CHAR_BIT__ - 2);
12 void fn0 (void)
14 __int128_t si128 = 0;
16 __builtin_sprintf (buf, "%*i", si128, 0);
18 __builtin_sprintf (buf, "%.*i", si128, 0);
20 __builtin_sprintf (buf, "%i", si128);
22 __builtin_sprintf (buf, "%2$*1$i", si128, 0);
24 __builtin_sprintf (buf, "%2$.*1$i", si128, 0);
27 void fn1 (void)
29 __int128_t si128 = sint128_max;
31 __builtin_sprintf (buf, "%*i", si128, 0);
33 __builtin_sprintf (buf, "%.*i", si128, 0);
35 __builtin_sprintf (buf, "%i", si128);
37 __builtin_sprintf (buf, "%2$*1$i", si128, 0);
39 __builtin_sprintf (buf, "%2$.*1$i", si128, 0);
42 /* { dg-prune-output "expects argument of type .int." } */