1*67e74705SXin Li // RUN: %clang --analyze -Xanalyzer -analyzer-output=text -fno-caret-diagnostics %s 2>&1 | FileCheck %s 2*67e74705SXin Li testA()3*67e74705SXin Livoid testA() { 4*67e74705SXin Li int *p = 0; 5*67e74705SXin Li *p = 1; 6*67e74705SXin Li 7*67e74705SXin Li // CHECK-LABEL: text-diagnostics.c:{{.*}}:6: warning: Dereference of null pointer (loaded from variable 'p') 8*67e74705SXin Li // CHECK-NEXT: text-diagnostics.c:[[@LINE-4]]:3: note: 'p' initialized to a null pointer value 9*67e74705SXin Li // CHECK-NEXT: text-diagnostics.c:[[@LINE-4]]:6: note: Dereference of null pointer (loaded from variable 'p') 10*67e74705SXin Li } 11*67e74705SXin Li testB(int * q)12*67e74705SXin Livoid testB(int *q) { 13*67e74705SXin Li if (q) 14*67e74705SXin Li return; 15*67e74705SXin Li *q = 1; 16*67e74705SXin Li 17*67e74705SXin Li // CHECK-LABEL: text-diagnostics.c:{{.*}}:6: warning: Dereference of null pointer (loaded from variable 'q') 18*67e74705SXin Li // CHECK-NEXT: text-diagnostics.c:[[@LINE-5]]:7: note: Assuming 'q' is null 19*67e74705SXin Li // CHECK-NEXT: text-diagnostics.c:[[@LINE-6]]:3: note: Taking false branch 20*67e74705SXin Li // CHECK-NEXT: text-diagnostics.c:[[@LINE-5]]:6: note: Dereference of null pointer (loaded from variable 'q') 21*67e74705SXin Li } 22