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 | 9a21d28b5da018ae94e8aa9ecae81f7c6a7cf7b8 (patch) | |
tree | a1a578406aca3307b14eb36386f42aef76704e9f /clang/lib/StaticAnalyzer/Core/Store.cpp | |
parent | 0e88118dd7e741fcbf25d63297f12dc8a1882558 (diff) | |
download | bcm5719-llvm-9a21d28b5da018ae94e8aa9ecae81f7c6a7cf7b8.tar.gz bcm5719-llvm-9a21d28b5da018ae94e8aa9ecae81f7c6a7cf7b8.zip |
[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
llvm-svn: 316399
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/Store.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/Store.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/Store.cpp b/clang/lib/StaticAnalyzer/Core/Store.cpp index 1af49f68cc0..173fdd8d005 100644 --- a/clang/lib/StaticAnalyzer/Core/Store.cpp +++ b/clang/lib/StaticAnalyzer/Core/Store.cpp @@ -440,7 +440,10 @@ SVal StoreManager::getLValueElement(QualType elementType, NonLoc Offset, // value. See also the similar FIXME in getLValueFieldOrIvar(). if (Base.isUnknownOrUndef() || Base.getAs<loc::ConcreteInt>()) return Base; - + + if (Base.getAs<loc::GotoLabel>()) + return UnknownVal(); + const SubRegion *BaseRegion = Base.castAs<loc::MemRegionVal>().getRegionAs<SubRegion>(); |