From 0957ad0803f472bcb2dc8a5f64aa5583d1d2c6fe Mon Sep 17 00:00:00 2001 From: Cristian Cadar Date: Fri, 25 May 2012 09:42:42 +0000 Subject: Patch by Paul Marinescu that makes KLEE gracefully fail on assembly code. Includes test case. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@157463 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Core/Executor.cpp | 7 ++++--- test/regression/2012-05-13-asm-causes-aborts.c | 8 ++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 test/regression/2012-05-13-asm-causes-aborts.c diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index 917a746d..c6bd379a 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -1592,6 +1592,10 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { if (f && isDebugIntrinsic(f, kmodule)) break; + if (isa(fp)) { + terminateStateOnExecError(state, "inline assembly is unsupported"); + break; + } // evaluate arguments std::vector< ref > arguments; arguments.reserve(numArgs); @@ -1633,9 +1637,6 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { i++; } - } else if (isa(fp)) { - terminateStateOnExecError(state, "inline assembly is unsupported"); - break; } executeCall(state, ki, f, arguments); diff --git a/test/regression/2012-05-13-asm-causes-aborts.c b/test/regression/2012-05-13-asm-causes-aborts.c new file mode 100644 index 00000000..6622d02b --- /dev/null +++ b/test/regression/2012-05-13-asm-causes-aborts.c @@ -0,0 +1,8 @@ +// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc +// RUN: %klee %t1.bc + +int main(int argc, char *argv[]){ + __asm__ __volatile__ ("movl %eax, %eax"); + return 0; +} + -- cgit 1.4.1