xref: /minix3/external/bsd/llvm/dist/clang/test/Analysis/null-deref-ps-region.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core -std=gnu99 -analyzer-store=region -verify %s
2*f4a2713aSLionel Sambuc // expected-no-diagnostics
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc // The store for 'a[1]' should not be removed mistakenly. SymbolicRegions may
6*f4a2713aSLionel Sambuc // also be live roots.
f14(int * a)7*f4a2713aSLionel Sambuc void f14(int *a) {
8*f4a2713aSLionel Sambuc   int i;
9*f4a2713aSLionel Sambuc   a[1] = 1;
10*f4a2713aSLionel Sambuc   i = a[1];
11*f4a2713aSLionel Sambuc   if (i != 1) {
12*f4a2713aSLionel Sambuc     int *p = 0;
13*f4a2713aSLionel Sambuc     i = *p; // no-warning
14*f4a2713aSLionel Sambuc   }
15*f4a2713aSLionel Sambuc }
16