1 // RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-output text \
4 void test_no_overflow_note(int a
, int b
)
8 if (__builtin_add_overflow(a
, b
, &res
)) // expected-note {{Assuming no overflow}}
9 // expected-note@-1 {{Taking false branch}}
12 if (res
) { // expected-note {{Assuming 'res' is not equal to 0}}
13 // expected-note@-1 {{Taking true branch}}
14 int *ptr
= 0; // expected-note {{'ptr' initialized to a null pointer value}}
15 int var
= *(int *) ptr
; //expected-warning {{Dereference of null pointer}}
16 //expected-note@-1 {{Dereference of null pointer}}
20 void test_overflow_note(int a
, int b
)
22 int res
; // expected-note{{'res' declared without an initial value}}
24 if (__builtin_add_overflow(a
, b
, &res
)) { // expected-note {{Assuming overflow}}
25 // expected-note@-1 {{Taking true branch}}
26 int var
= res
; // expected-warning{{Assigned value is garbage or undefined}}
27 // expected-note@-1 {{Assigned value is garbage or undefined}}