Bug Summary

File:/Users/vsavchenko/source/llvm-project/clang/test/Analysis/html_diagnostics/control-arrows.cpp
Warning:line 8, column 10
Dereference of null pointer (loaded from variable 'x')

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -internal-isystem /Users/vsavchenko/source/llvm-project/build/ReleaseAsserts/lib/clang/12.0.0/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -analyzer-output=html -o /Users/vsavchenko/source/llvm-project/build/ReleaseAsserts/tools/clang/test/Analysis/html_diagnostics/Output/control-arrows.cpp.tmp -verify /Users/vsavchenko/source/llvm-project/clang/test/Analysis/html_diagnostics/control-arrows.cpp
1// RUN: rm -fR %t
2// RUN: mkdir %t
3// RUN: %clang_analyze_cc1 -analyzer-checker=core \
4// RUN: -analyzer-output=html -o %t -verify %s
5// RUN: cat %t/report-*.html | FileCheck %s
6
7int dereference(int *x) {
8 return *x; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}}
6
Dereference of null pointer (loaded from variable 'x')
9}
10
11int foobar(bool cond, int *x) {
12 if (cond)
1
Assuming 'cond' is true
2
Taking true branch
13 x = 0;
3
Null pointer value stored to 'x'
14 return dereference(x);
4
Passing null pointer value via 1st parameter 'x'
5
Calling 'dereference'
15}
16
17// CHECK: <svg
18// CHECK: <g
19// CHECK-COUNT-9: <path class="arrow" id="arrow{{[0-9]+}}"/>
20// CHECK-NOT: <path class="arrow" id="arrow{{[0-9]+}}"/>
21// CHECK: </g>
22// CHECK-NEXT: </svg>
23// CHECK-NEXT: <script type='text/javascript'>
24// CHECK-NEXT: const arrowIndices = [ 9,8,6,5,3,2,0 ]
25// CHECK-NEXT: </script>
26//
27// Except for arrows we still want to have grey bubbles with control notes.
28// CHECK: <div id="Path2" class="msg msgControl"
29// CHECK-SAME: <div class="PathIndex PathIndexControl">2</div>
30// CHECK-SAME: <td>Taking true branch</td>