summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr87099.c
blob: 47e2315de0e91ae9c257bbf09bba6fb043f10704 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* PR middle-end/87099 */
/* { dg-do compile } */
/* { dg-require-effective-target alloca } */
/* { dg-options "-Wstringop-overflow" } */

void bar (char *);

int
foo (int n)
{
  char v[n];
  bar (v);
  return __builtin_strncmp (&v[1], "aaa", 3);
}

int
baz (int n, char *s)
{
  char v[n];
  bar (v);
  return __builtin_strncmp (&v[1], s, 3);
}