aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/strcpy-2.c
blob: e4e6c975d142a911cef9ddfeef498021a1de8c0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* { dg-additional-options "-fdump-analyzer-untracked" } */

#include "analyzer-decls.h"

struct S
{
  char buf[10];
};

/* strcpy to a static struct that never gets used.  */

void
test_1 (const char *src)
{
  static struct S s; /* { dg-warning "track 's': no" } */
  __builtin_strcpy (s.buf, src);
}

/* strcpy to a static struct that later gets used.  */

const char *
test_2 (const char *src)
{
  static struct S s; /* { dg-warning "track 's': yes" } */
  __builtin_strcpy (s.buf, src);
  return s.buf;
}