aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/memset-2.c
blob: de7c973b1fddbe5ce4c88f68fcc982e982df38b2 (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
{
  int i;
};

/* memset of a static struct that never gets used.  */

void
test_1 (void)
{
  static struct S s; /* { dg-warning "track 's': no" } */
  __builtin_memset (&s, 0, sizeof (s));
}

/* memset of a static struct that later gets used.  */

void
test_2 (void)
{
  static struct S s; /* { dg-warning "track 's': yes" } */
  __builtin_memset (&s, 0, sizeof (s));
  __analyzer_eval (s.i == 0); /* { dg-warning "TRUE" } */
}