summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr79222.c
blob: 87e9fb68b7991888e683842b4232e6c2100a5ceb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/* PR middle-end/79222 - missing -Wstringop-overflow= on a stpcpy overflow
   { dg-do compile }
   { dg-options "-O2" } */

extern char* stpcpy (char*, const char*);

char d[3];

char* f (int i)
{
  const char *s = i < 0 ? "01234567" : "9876543210";
  return stpcpy (d, s);   /* { dg-warning ".stpcpy. writing between 9 and 11 bytes into a region of size 3 overflows the destination" } */
}