diff options
Diffstat (limited to 'clang/test/Analysis')
| -rw-r--r-- | clang/test/Analysis/func.c | 2 | ||||
| -rw-r--r-- | clang/test/Analysis/idempotent-operations.c | 15 | ||||
| -rw-r--r-- | clang/test/Analysis/misc-ps-region-store.m | 2 | ||||
| -rw-r--r-- | clang/test/Analysis/misc-ps.m | 2 |
4 files changed, 18 insertions, 3 deletions
diff --git a/clang/test/Analysis/func.c b/clang/test/Analysis/func.c index a7e84615fd3..53c873df55a 100644 --- a/clang/test/Analysis/func.c +++ b/clang/test/Analysis/func.c @@ -4,7 +4,7 @@ void f(void) { void (*p)(void); p = f; - p = &f; // expected-warning{{Assigned value is always the same as the existing value}} + p = &f; p(); (*p)(); } diff --git a/clang/test/Analysis/idempotent-operations.c b/clang/test/Analysis/idempotent-operations.c index debff0efff4..5c9a59d7361 100644 --- a/clang/test/Analysis/idempotent-operations.c +++ b/clang/test/Analysis/idempotent-operations.c @@ -172,3 +172,18 @@ int false6() { return localInt; } + +// Check that assignments filter out false positives correctly +int false7() { + int zero = 0; // psuedo-constant + int one = 1; + + int a = 55; + a = a; // expected-warning{{Assigned value is always the same as the existing value}} + a = enum1 * a; // no-warning + + int b = 123; + b = b; // no-warning + + return a; +} diff --git a/clang/test/Analysis/misc-ps-region-store.m b/clang/test/Analysis/misc-ps-region-store.m index d46437388d3..38275335ee9 100644 --- a/clang/test/Analysis/misc-ps-region-store.m +++ b/clang/test/Analysis/misc-ps-region-store.m @@ -708,7 +708,7 @@ int pr5857(char *src) { long long *z = (long long *) (intptr_t) src; long long w = 0; int n = 0; - for (n = 0; n < y; ++n) { // expected-warning{{Assigned value is always the same as the existing value}} + for (n = 0; n < y; ++n) { // Previously we crashed analyzing this statement. w = *z++; } diff --git a/clang/test/Analysis/misc-ps.m b/clang/test/Analysis/misc-ps.m index 6aac74b1091..42eccfeec43 100644 --- a/clang/test/Analysis/misc-ps.m +++ b/clang/test/Analysis/misc-ps.m @@ -458,7 +458,7 @@ void rdar_7062158_2() { // ElementRegion is created. unsigned char test_array_index_bitwidth(const unsigned char *p) { unsigned short i = 0; - for (i = 0; i < 2; i++) p = &p[i]; // expected-warning{{Assigned value is always the same as the existing value}} + for (i = 0; i < 2; i++) p = &p[i]; return p[i+1]; } |

