Mercurial > hg > CbC > CbC_gcc
diff gcc/testsuite/gcc.dg/pr80776-1.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gcc/testsuite/gcc.dg/pr80776-1.c Thu Oct 25 07:37:49 2018 +0900 @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wformat-overflow" } */ + +extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) __attribute__ ((__artificial__)) int +__attribute__ ((__nothrow__ , __leaf__)) sprintf (char *__restrict __s, const char *__restrict __fmt, ...) +{ + return __builtin___sprintf_chk (__s, 2 - 1, + __builtin_object_size (__s, 2 > 1), __fmt, __builtin_va_arg_pack ()); +} +char number[sizeof "999999"]; +int somerandom (void); +void +Foo (void) +{ + int i = somerandom (); + if (! (0 <= i)) + __builtin_unreachable (); + if (! (0 <= i && i <= 999999)) + __builtin_unreachable (); + /* The correctness bits for [E]VRP cannot handle chained conditionals + when deciding to ignore a unreachable branch for setting SSA range info. */ + sprintf (number, "%d", i); /* { dg-bogus "writing" "" { xfail *-*-* } } */ +}