summaryrefslogtreecommitdiffstats
path: root/test/Analysis/pr22954.c
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2018-04-19 23:24:32 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2018-04-19 23:24:32 +0000
commitaddfb0519a3a8b1eea81c83b8f458722a1775e44 (patch)
treeee71b0be1182ff189634f0a06d56cd7e31256e88 /test/Analysis/pr22954.c
parenta7da2380bd9d5e0de4b899e6048ea9a1c8788ec0 (diff)
[analyzer] When we fail to evaluate a pointer cast, escape the pointer.
If a pointer cast fails (evaluates to an UnknownVal, i.e. not implemented in the analyzer) and such cast is in fact the last use of the pointer, the pointer symbol is no longer referenced by the program state and a leak is (mis-)diagnosed. "Escape" the pointer upon a failed cast, i.e. inform the checker that we can no longer reliably track it. Differential Revision: https://reviews.llvm.org/D45698 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@330380 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/pr22954.c')
-rw-r--r--test/Analysis/pr22954.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/Analysis/pr22954.c b/test/Analysis/pr22954.c
index 64a00c5ec0..b4273c0a89 100644
--- a/test/Analysis/pr22954.c
+++ b/test/Analysis/pr22954.c
@@ -624,9 +624,10 @@ int f29(int i, int j, int k, int l, int m) {
clang_analyzer_eval(m29[i].s3[1] == 1); // expected-warning{{UNKNOWN}}
clang_analyzer_eval(m29[i].s3[2] == 1); // expected-warning{{UNKNOWN}}
clang_analyzer_eval(m29[i].s3[3] == 1); // expected-warning{{UNKNOWN}}
- clang_analyzer_eval(m29[j].s3[k] == 1); // expected-warning{{TRUE}}\
- expected-warning{{Potential leak of memory pointed to by field 's4'}}
+ clang_analyzer_eval(m29[j].s3[k] == 1); // expected-warning{{TRUE}}
clang_analyzer_eval(l29->s1[m] == 2); // expected-warning{{UNKNOWN}}
+ // FIXME: Should warn that m29[i].s4 leaks. But not on the previous line,
+ // because l29 and m29 alias.
return 0;
}