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