[PATCH] D27043: Remove assertion on analysis of rvalue vector
Phil Camp via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 23 06:19:26 PST 2016
FlameTop created this revision.
FlameTop added reviewers: zaks.anna, dcoughlin.
FlameTop added a subscriber: cfe-commits.
ExprEngine::VisitLvalArraySubscriptExpr contains an assert to ensure it is passed either a GLvalue or a small number of C exemptions. This change adds vector types to the assert as these also can be rvalues.
A provided test ensures the assertion no longer fires for vector rvalues.
https://reviews.llvm.org/D27043
Files:
llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
llvm/tools/clang/test/Analysis/crash-vector-rvalue.c
Index: llvm/tools/clang/test/Analysis/crash-vector-rvalue.c
===================================================================
--- /dev/null
+++ llvm/tools/clang/test/Analysis/crash-vector-rvalue.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s
+typedef int vec __attribute__((__vector_size__(4)));;
+vec bar();
+int foo() {
+ int op = bar()[2];
+ return op;
+}
Index: llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
===================================================================
--- llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -1973,7 +1973,8 @@
StmtNodeBuilder Bldr(checkerPreStmt, Dst, *currBldrCtx);
assert(A->isGLValue() ||
- (!AMgr.getLangOpts().CPlusPlus &&
+ A->getBase()->getType()->isVectorType() ||
+ (!AMgr.getLangOpts().CPlusPlus &&
A->getType().isCForbiddenLValueType()));
for (ExplodedNodeSet::iterator it = checkerPreStmt.begin(),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27043.79062.patch
Type: text/x-patch
Size: 1020 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161123/85f19f51/attachment.bin>
More information about the cfe-commits
mailing list