2018-05-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr80776-1.c
blobaf41c0c2ffabf74396bd6196d11657e87e078105
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Wformat-overflow" } */
4 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) __attribute__ ((__artificial__)) int
5 __attribute__ ((__nothrow__ , __leaf__)) sprintf (char *__restrict __s, const char *__restrict __fmt, ...)
7 return __builtin___sprintf_chk (__s, 2 - 1,
8 __builtin_object_size (__s, 2 > 1), __fmt, __builtin_va_arg_pack ());
10 char number[sizeof "999999"];
11 int somerandom (void);
12 void
13 Foo (void)
15 int i = somerandom ();
16 if (! (0 <= i))
17 __builtin_unreachable ();
18 if (! (0 <= i && i <= 999999))
19 __builtin_unreachable ();
20 /* The correctness bits for [E]VRP cannot handle chained conditionals
21 when deciding to ignore a unreachable branch for setting SSA range info. */
22 sprintf (number, "%d", i); /* { dg-bogus "writing" "" { xfail *-*-* } } */