diff options
author | Alexander Shaposhnikov <shal1t712@gmail.com> | 2017-10-23 23:46:06 +0000 |
---|---|---|
committer | Alexander Shaposhnikov <shal1t712@gmail.com> | 2017-10-23 23:46:06 +0000 |
commit | 117339c38e266bf28c69d0bf29d35cb5ca79e2d8 (patch) | |
tree | 1f9b30a713a1cc9423deba0f666b3c654b64ef87 /test/Analysis | |
parent | b1ead8ba0f35dc3bf852be933dc2fe123fefa2ea (diff) |
[analyzer] Fix handling of labels in getLValueElement
In getLValueElement Base may represent the address of a label
(as in the newly-added test case), in this case it's not a loc::MemRegionVal
and Base.castAs<loc::MemRegionVal>() triggers an assert, this diff makes
getLValueElement return UnknownVal instead.
Differential revision: https://reviews.llvm.org/D39174
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316399 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r-- | test/Analysis/ptr-arith.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/Analysis/ptr-arith.c b/test/Analysis/ptr-arith.c index b78ec503a1..93cb4ee9a6 100644 --- a/test/Analysis/ptr-arith.c +++ b/test/Analysis/ptr-arith.c @@ -342,3 +342,8 @@ void negativeIndex(char *str) { clang_analyzer_eval(*ptr3 == 'a'); // expected-warning{{UNKNOWN}} } +void test_no_crash_on_pointer_to_label() { + char *a = &&label; + a[0] = 0; +label:; +} |