aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/pr96651-1.c
blob: 2f3a9b44a2c33189c1c0650ddb1e13401a0bc51c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

static int a;

int main(void)
{
  char *src = NULL;
  char buf[128];

  /* "a" can't have been touched yet, and thus
     is implicitly zero.  */
  switch (a) {
  case 1:
    strcpy(buf, src); /* { dg-bogus "NULL" } */
    break;
  case 0:
    strcpy(buf, "hello");
  }
  printf("%s\n", buf);
}