diff options
Diffstat (limited to 'test/Analysis/uninit-const.c')
-rw-r--r-- | test/Analysis/uninit-const.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/test/Analysis/uninit-const.c b/test/Analysis/uninit-const.c index 9a6529a772a7..407c28a5e8ba 100644 --- a/test/Analysis/uninit-const.c +++ b/test/Analysis/uninit-const.c @@ -1,4 +1,6 @@ -// RUN: %clang_analyze_cc1 -analyzer-checker=unix.Malloc,core,alpha.core.CallAndMessageUnInitRefArg -analyzer-output=text -verify %s +// RUN: %clang_analyze_cc1 -analyzer-checker=unix.Malloc,core,alpha.core.CallAndMessageUnInitRefArg,debug.ExprInspection -analyzer-output=text -verify %s + +void clang_analyzer_warnIfReached(); // Passing uninitialized const data to function #include "Inputs/system-header-simulator.h" @@ -121,6 +123,32 @@ void f_12(void) { } +// https://bugs.llvm.org/show_bug.cgi?id=35419 +void f11_0(void) { + int x; // expected-note {{'x' declared without an initial value}} + x++; // expected-warning {{The expression is an uninitialized value. The computed value will also be garbage}} + // expected-note@-1 {{The expression is an uninitialized value. The computed value will also be garbage}} + clang_analyzer_warnIfReached(); // no-warning +} +void f11_1(void) { + int x; // expected-note {{'x' declared without an initial value}} + ++x; // expected-warning {{The expression is an uninitialized value. The computed value will also be garbage}} + // expected-note@-1 {{The expression is an uninitialized value. The computed value will also be garbage}} + clang_analyzer_warnIfReached(); // no-warning +} +void f11_2(void) { + int x; // expected-note {{'x' declared without an initial value}} + x--; // expected-warning {{The expression is an uninitialized value. The computed value will also be garbage}} + // expected-note@-1 {{The expression is an uninitialized value. The computed value will also be garbage}} + clang_analyzer_warnIfReached(); // no-warning +} +void f11_3(void) { + int x; // expected-note {{'x' declared without an initial value}} + --x; // expected-warning {{The expression is an uninitialized value. The computed value will also be garbage}} + // expected-note@-1 {{The expression is an uninitialized value. The computed value will also be garbage}} + clang_analyzer_warnIfReached(); // no-warning +} + int f_malloc_1(void) { int *ptr; |