[PATCH] D63533: [analyzer] Fix clang-tidy crash on GCCAsmStmt
Nathan Huckleberry via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 27 15:52:36 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL364605: [analyzer] Fix clang-tidy crash on GCCAsmStmt (authored by Nathan-Huckleberry, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D63533?vs=206954&id=206956#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63533/new/
https://reviews.llvm.org/D63533
Files:
cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
cfe/trunk/test/Analysis/egraph-asm-goto-no-crash.cpp
Index: cfe/trunk/test/Analysis/egraph-asm-goto-no-crash.cpp
===================================================================
--- cfe/trunk/test/Analysis/egraph-asm-goto-no-crash.cpp
+++ cfe/trunk/test/Analysis/egraph-asm-goto-no-crash.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s
+
+// expected-no-diagnostics
+
+void clang_analyzer_warnIfReached();
+
+void testAsmGoto() {
+ asm goto("xor %0, %0\n je %l[label1]\n jl %l[label2]"
+ : /* no outputs */
+ : /* inputs */
+ : /* clobbers */
+ : label1, label2 /* any labels used */);
+
+ // FIXME: Should be reachable.
+ clang_analyzer_warnIfReached();
+
+ label1:
+ // FIXME: Should be reachable.
+ clang_analyzer_warnIfReached();
+ return;
+
+ label2:
+ // FIXME: Should be reachable.
+ clang_analyzer_warnIfReached();
+ return;
+}
Index: cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -396,6 +396,11 @@
case Stmt::WhileStmtClass:
HandleBranch(cast<WhileStmt>(Term)->getCond(), Term, B, Pred);
return;
+
+ case Stmt::GCCAsmStmtClass:
+ assert(cast<GCCAsmStmt>(Term)->isAsmGoto() && "Encountered GCCAsmStmt without labels");
+ // TODO: Handle jumping to labels
+ return;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63533.206956.patch
Type: text/x-patch
Size: 1475 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190627/29cef6be/attachment.bin>
More information about the llvm-commits
mailing list