diff --git a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp --- a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp @@ -396,6 +396,11 @@ case Stmt::WhileStmtClass: HandleBranch(cast(Term)->getCond(), Term, B, Pred); return; + + case Stmt::GCCAsmStmtClass: + assert(cast(Term)->isAsmGoto() == true); + // TODO: Handle jumping to labels + return; } } diff --git a/clang/test/Analysis/egraph-asm-goto-no-crash.cpp b/clang/test/Analysis/egraph-asm-goto-no-crash.cpp new file mode 100644 --- /dev/null +++ b/clang/test/Analysis/egraph-asm-goto-no-crash.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-dump-egraph=%t.dot %s +// RUN: cat %t.dot | FileCheck %s + +void *target; +int indirectBlockSuccessorDeterminism() { + int x = 0; + asm goto( "xor %0, %0\n je %l[label1]\n jl %l[label2]" : /* no outputs */ : /* inputs */ : /* clobbers */ : label1, label2 /* any labels used */ ); + + label1: + x++; + return x; + + label2: + x--; + return x; +} + +// CHECK: digraph "Exploded Graph" {