diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
commit | 461a67fa15370a9ec88f8f8a240bf7c123bb2029 (patch) | |
tree | 6942083d7d56bba40ec790a453ca58ad3baf6832 /test/Analysis/uninit-const.c | |
parent | 75c3240472ba6ac2669ee72ca67eb72d4e2851fc (diff) |
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 9a6529a772a7b..407c28a5e8bab 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; |