aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr80776-2.c
blob: 55cef3b1a9b370184790f1b89821a38885cd147e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* { dg-do compile } */
/* { dg-options "-O2 -Wformat-overflow" } */

extern int sprintf (char *restrict, const char *restrict, ...)
     __attribute__ ((__nothrow__));
     extern int foo (void);

int
Fgenerate_new_buffer_name (void)
{
  char number[2];
  int i = foo ();
  if (i < 0)
    __builtin_unreachable ();
  if (i >= 2)
    __builtin_unreachable ();
  return sprintf (number, "%d", i); /* { dg-bogus "writing" } */
}