Hello community,
here is the log from the commit of package klee for openSUSE:Factory checked in at 2018-01-31 19:53:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/klee (Old)
and /work/SRC/openSUSE:Factory/.klee.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "klee"
Wed Jan 31 19:53:28 2018 rev:8 rq:571294 version:1.4.0+20180108
Changes:
--------
--- /work/SRC/openSUSE:Factory/klee/klee.changes 2018-01-16 09:43:01.595846660 +0100
+++ /work/SRC/openSUSE:Factory/.klee.new/klee.changes 2018-01-31 19:53:57.747699321 +0100
@@ -1,0 +2,47 @@
+Wed Jan 24 07:59:06 UTC 2018 - jslaby@suse.com
+
+- Add klee-skip-some-tests.patch
+
+-------------------------------------------------------------------
+Mon Jan 15 10:24:53 UTC 2018 - jslaby@suse.com
+
+- Update to version 1.4.0+20180108:
+ * [NFC] Remove unused config header template that was only used by the old build system (now removed).
+ * fix regression test: use `%klee` instead of `klee`
+ * fix merging tests: use `%klee` instead of `klee`
+ * Move Homebrew tap from personal repository to the KLEE organization
+ * Updated TravisCI to use pip2 instead of pip
+ * Bumped xcode version for TravisCI
+ * Implemented bounded merging functionality
+ * Added pause and continue functionality for states in Executor
+ * Replace confusing message in lit.site.cfg.in about the file being autogenerated
+ * klee_make_symbolic: add test cases for API
+ * klee_make_symbolic: warn on deprecated usage
+- added patches:
+ * 0001-MergeHandler-remove-unused-closedStateCount.patch
+ * 0002-llvm50-use-auto-variable-instead-of-SwitchInst-CaseI.patch
+ * 0013-llvm40-gep_type_iterator-has-no-operator.patch
+ * 0014-llvm50-avoid-on-function-arg_begin.patch
+ * 0015-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch
+ * 0016-llvm50-handle-getOrInsertFunction-terminator.patch
+ * 0017-llvm50-SwitchInst-case-functions-now-return-pointers.patch
+ * 0018-llvm50-handle-new-file_magic-s-location.patch
+ * 0019-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch
+ * 0020-llvm50-AllocaInst-takes-address-space.patch
+- renamed patches:
+ * 0013-llvm38-test-change-some-tests.patch ->
+ 0007-llvm38-test-change-some-tests.patch
+ * 0007-llvm40-handle-different-header-names.patch ->
+ 0008-llvm40-handle-different-header-names.patch
+ * 0008-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch ->
+ 0009-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch
+ * 0009-llvm40-errorOr-and-similar.patch ->
+ 0010-llvm40-errorOr-and-similar.patch
+ * 0010-llvm-use-chrono-helpers-from-LLVM-4.0.patch ->
+ 0011-llvm-use-chrono-helpers-from-LLVM-4.0.patch
+ * 0011-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch ->
+ 0012-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch
+ * 0012-llvm40-gep_type_iterator-has-no-operator.patch ->
+ 0013-llvm40-gep_type_iterator-has-no-operator.patch
+
+-------------------------------------------------------------------
Old:
----
0007-llvm40-handle-different-header-names.patch
0008-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch
0009-llvm40-errorOr-and-similar.patch
0010-llvm-use-chrono-helpers-from-LLVM-4.0.patch
0011-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch
0012-llvm40-gep_type_iterator-has-no-operator.patch
0013-llvm38-test-change-some-tests.patch
klee-1.4.0+20171026.tar.xz
New:
----
0001-MergeHandler-remove-unused-closedStateCount.patch
0002-llvm50-use-auto-variable-instead-of-SwitchInst-CaseI.patch
0007-llvm38-test-change-some-tests.patch
0008-llvm40-handle-different-header-names.patch
0009-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch
0010-llvm40-errorOr-and-similar.patch
0011-llvm-use-chrono-helpers-from-LLVM-4.0.patch
0012-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch
0013-llvm40-gep_type_iterator-has-no-operator.patch
0014-llvm50-avoid-on-function-arg_begin.patch
0015-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch
0016-llvm50-handle-getOrInsertFunction-terminator.patch
0017-llvm50-SwitchInst-case-functions-now-return-pointers.patch
0018-llvm50-handle-new-file_magic-s-location.patch
0019-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch
0020-llvm50-AllocaInst-takes-address-space.patch
klee-1.4.0+20180108.tar.xz
klee-skip-some-tests.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ klee.spec ++++++
--- /var/tmp/diff_new_pack.3WQrfy/_old 2018-01-31 19:53:58.455666397 +0100
+++ /var/tmp/diff_new_pack.3WQrfy/_new 2018-01-31 19:53:58.459666211 +0100
@@ -19,7 +19,7 @@
%define llvm_version_minor 0
%define llvm_version %{llvm_version_major}
-%define version_unconverted 1.4.0+20171026
+%define version_unconverted 1.4.0+20180108
%ifarch %{ix86} x86_64
%define with_uclibc 1
@@ -31,36 +31,49 @@
Summary: LLVM Execution Engine
License: NCSA
Group: Development/Languages/Other
-Version: 1.4.0+20171026
+Version: 1.4.0+20180108
Release: 0
Url: http://klee.github.io/
Source0: %{name}-%{version}.tar.xz
Source1: %{name}-rpmlintrc
Source2: https://raw.githubusercontent.com/llvm-mirror/llvm/release_%{llvm_version_major}%{llvm_version_minor}/utils/not/not.cpp
Source3: https://raw.githubusercontent.com/llvm-mirror/llvm/release_%{llvm_version_major}%{llvm_version_minor}/utils/FileCheck/FileCheck.cpp
-Patch1: 0001-Fix-generation-of-expressions-from-constant-sequenti.patch
-Patch2: 0002-Fix-getelementptr-for-array-or-vector-indices.patch
-Patch3: 0003-Fix-correct-element-order-of-InsertElement-ExtractEl.patch
-Patch4: 0004-Provide-errno-independent-of-CTYPE_EXTERNALS-being-d.patch
-Patch5: 0005-Track-errno-correctly.patch
-Patch6: 0006-Declare-klee_get_errno-and-remove-local-declarations.patch
-Patch7: 0007-Add-support-for-modelling-errno_location.patch
-Patch8: 0008-Cleanup-test-cases.patch
-Patch9: 0009-test-fix-Feature-BFSSearcherAndDFSSearcherInterleave.patch
-#---
-Patch10: 0001-llvm37-handle-GetElementPtrInst-Create-s-new-paramet.patch
-Patch11: 0002-llvm-make-KLEE-compile-against-LLVM-3.7.patch
-Patch12: 0003-test-add-versions-of-some-tests-for-LLVM-3.7.patch
-Patch13: 0004-llvm37-handle-getRegisteredOptions.patch
-Patch14: 0005-llvm-make-KLEE-compile-against-LLVM-3.8.patch
-Patch15: 0006-llvm-make-KLEE-compile-against-LLVM-3.9.patch
-Patch16: 0007-llvm40-handle-different-header-names.patch
-Patch17: 0008-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch
-Patch18: 0009-llvm40-errorOr-and-similar.patch
-Patch19: 0010-llvm-use-chrono-helpers-from-LLVM-4.0.patch
-Patch20: 0011-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch
-Patch21: 0012-llvm40-gep_type_iterator-has-no-operator.patch
-Patch22: 0013-llvm38-test-change-some-tests.patch
+
+Patch1: 0001-MergeHandler-remove-unused-closedStateCount.patch
+Patch2: 0002-llvm50-use-auto-variable-instead-of-SwitchInst-CaseI.patch
+
+Patch101: 0001-Fix-generation-of-expressions-from-constant-sequenti.patch
+Patch102: 0002-Fix-getelementptr-for-array-or-vector-indices.patch
+Patch103: 0003-Fix-correct-element-order-of-InsertElement-ExtractEl.patch
+Patch104: 0004-Provide-errno-independent-of-CTYPE_EXTERNALS-being-d.patch
+Patch105: 0005-Track-errno-correctly.patch
+Patch106: 0006-Declare-klee_get_errno-and-remove-local-declarations.patch
+Patch107: 0007-Add-support-for-modelling-errno_location.patch
+Patch108: 0008-Cleanup-test-cases.patch
+Patch109: 0009-test-fix-Feature-BFSSearcherAndDFSSearcherInterleave.patch
+
+Patch201: 0001-llvm37-handle-GetElementPtrInst-Create-s-new-paramet.patch
+Patch202: 0002-llvm-make-KLEE-compile-against-LLVM-3.7.patch
+Patch203: 0003-test-add-versions-of-some-tests-for-LLVM-3.7.patch
+Patch204: 0004-llvm37-handle-getRegisteredOptions.patch
+Patch205: 0005-llvm-make-KLEE-compile-against-LLVM-3.8.patch
+Patch206: 0006-llvm-make-KLEE-compile-against-LLVM-3.9.patch
+Patch207: 0007-llvm38-test-change-some-tests.patch
+Patch208: 0008-llvm40-handle-different-header-names.patch
+Patch209: 0009-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch
+Patch210: 0010-llvm40-errorOr-and-similar.patch
+Patch211: 0011-llvm-use-chrono-helpers-from-LLVM-4.0.patch
+Patch212: 0012-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch
+Patch213: 0013-llvm40-gep_type_iterator-has-no-operator.patch
+Patch214: 0014-llvm50-avoid-on-function-arg_begin.patch
+Patch215: 0015-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch
+Patch216: 0016-llvm50-handle-getOrInsertFunction-terminator.patch
+Patch217: 0017-llvm50-SwitchInst-case-functions-now-return-pointers.patch
+Patch218: 0018-llvm50-handle-new-file_magic-s-location.patch
+Patch219: 0019-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch
+Patch220: 0020-llvm50-AllocaInst-takes-address-space.patch
+
+Patch300: klee-skip-some-tests.patch
BuildRequires: clang%{llvm_version}
BuildRequires: cmake
@@ -89,26 +102,40 @@
%setup -q
%patch1 -p1
%patch2 -p1
-%patch3 -p1
-%patch4 -p1
-%patch5 -p1
-%patch6 -p1
-%patch7 -p1
-%patch8 -p1
-%patch9 -p1
-%patch10 -p1
-%patch11 -p1
-%patch12 -p1
-%patch13 -p1
-%patch14 -p1
-%patch15 -p1
-%patch16 -p1
-%patch17 -p1
-%patch18 -p1
-%patch19 -p1
-%patch20 -p1
-%patch21 -p1
-%patch22 -p1
+
+%patch101 -p1
+%patch102 -p1
+%patch103 -p1
+%patch104 -p1
+%patch105 -p1
+%patch106 -p1
+%patch107 -p1
+%patch108 -p1
+%patch109 -p1
+
+%patch201 -p1
+%patch202 -p1
+%patch203 -p1
+%patch204 -p1
+%patch205 -p1
+%patch206 -p1
+%patch207 -p1
+%patch208 -p1
+%patch209 -p1
+%patch210 -p1
+%patch211 -p1
+%patch212 -p1
+%patch213 -p1
+%patch214 -p1
+%patch215 -p1
+%patch216 -p1
+%patch217 -p1
+%patch218 -p1
+%patch219 -p1
+%patch220 -p1
+
+%patch300 -p1
+
mkdir -p build/test/
cp %{SOURCE2} build/test/
cp %{SOURCE3} build/test/
++++++ 0001-Fix-generation-of-expressions-from-constant-sequenti.patch ++++++
--- /var/tmp/diff_new_pack.3WQrfy/_old 2018-01-31 19:53:58.479665281 +0100
+++ /var/tmp/diff_new_pack.3WQrfy/_new 2018-01-31 19:53:58.479665281 +0100
@@ -27,5 +27,5 @@
}
ref<Expr> res = ConcatExpr::createN(kids.size(), kids.data());
--
-2.15.0
+2.15.1
++++++ 0001-MergeHandler-remove-unused-closedStateCount.patch ++++++
From: Jiri Slaby
Date: Mon, 15 Jan 2018 09:20:32 +0100
Subject: MergeHandler: remove unused closedStateCount
Patch-mainline: no
clang 5 reports:
In file included from ../lib/Core/MergeHandler.cpp:10:
../include/klee/MergeHandler.h:81:12: warning: private field 'closedStateCount' is not used [-Wunused-private-field]
unsigned closedStateCount;
^
So fix it by removing the member.
Signed-off-by: Jiri Slaby
---
include/klee/MergeHandler.h | 4 ----
1 file changed, 4 deletions(-)
diff --git a/include/klee/MergeHandler.h b/include/klee/MergeHandler.h
index d374e1684036..0c596825e867 100644
--- a/include/klee/MergeHandler.h
+++ b/include/klee/MergeHandler.h
@@ -76,10 +76,6 @@ class MergeHandler {
private:
Executor *executor;
- /// @brief Number of states that are tracked by this MergeHandler, that ran
- /// into a relevant klee_close_merge
- unsigned closedStateCount;
-
/// @brief Mapping the different 'klee_close_merge' calls to the states that ran into
/// them
std::map >
--
2.15.1
++++++ 0001-llvm37-handle-GetElementPtrInst-Create-s-new-paramet.patch ++++++
--- /var/tmp/diff_new_pack.3WQrfy/_old 2018-01-31 19:53:58.507663979 +0100
+++ /var/tmp/diff_new_pack.3WQrfy/_new 2018-01-31 19:53:58.507663979 +0100
@@ -68,5 +68,5 @@
}
ii->removeFromParent();
--
-2.15.0
+2.15.1
++++++ 0002-Fix-getelementptr-for-array-or-vector-indices.patch ++++++
--- /var/tmp/diff_new_pack.3WQrfy/_old 2018-01-31 19:53:58.523663235 +0100
+++ /var/tmp/diff_new_pack.3WQrfy/_new 2018-01-31 19:53:58.527663049 +0100
@@ -96,5 +96,5 @@
}
--
-2.15.0
+2.15.1
++++++ 0002-llvm-make-KLEE-compile-against-LLVM-3.7.patch ++++++
--- /var/tmp/diff_new_pack.3WQrfy/_old 2018-01-31 19:53:58.535662677 +0100
+++ /var/tmp/diff_new_pack.3WQrfy/_new 2018-01-31 19:53:58.535662677 +0100
@@ -161,7 +161,7 @@
TLI = TM->getSubtargetImpl()->getTargetLowering();
#else
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
-index 4a820578bf16..f8706f9f74e5 100644
+index 9bdf06f600ce..ea24d89c5aaf 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -35,6 +35,7 @@
@@ -173,5 +173,5 @@
#include "llvm/Support/TargetSelect.h"
--
-2.15.0
+2.15.1
++++++ 0002-llvm50-use-auto-variable-instead-of-SwitchInst-CaseI.patch ++++++
From: Jiri Slaby
Date: Mon, 15 Jan 2018 10:24:48 +0100
Subject: llvm50: use auto variable instead of SwitchInst::CaseIt
Patch-mainline: no
llvm50 changed the semantics of SwitchInst::CaseIt and started using
"auto" variable type. So use it here too for all versions.
Signed-off-by: Jiri Slaby
---
lib/Core/Executor.cpp | 3 +--
lib/Module/LowerSwitch.cpp | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index be92b16a459d..d836598927ce 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -1553,8 +1553,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
std::map[ expressionOrder;
// Iterate through all non-default cases and order them by expressions
- for (SwitchInst::CaseIt i = si->case_begin(), e = si->case_end(); i != e;
- ++i) {
+ for (auto i : si->cases()) {
ref<Expr> value = evalConstant(i.getCaseValue());
BasicBlock *caseSuccessor = i.getCaseSuccessor();
diff --git a/lib/Module/LowerSwitch.cpp b/lib/Module/LowerSwitch.cpp
index 1a194245a09a..02f00a3ae94e 100644
--- a/lib/Module/LowerSwitch.cpp
+++ b/lib/Module/LowerSwitch.cpp
@@ -115,7 +115,7 @@ void LowerSwitchPass::processSwitchInst(SwitchInst *SI) {
CaseVector cases;
- for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end(); i != e; ++i)
+ for (auto i : SI->cases())
cases.push_back(SwitchCase(i.getCaseValue(),
i.getCaseSuccessor()));
--
2.15.1
++++++ 0003-Fix-correct-element-order-of-InsertElement-ExtractEl.patch ++++++
--- /var/tmp/diff_new_pack.3WQrfy/_old 2018-01-31 19:53:58.563661375 +0100
+++ /var/tmp/diff_new_pack.3WQrfy/_new 2018-01-31 19:53:58.563661375 +0100
@@ -9,10 +9,10 @@
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
-index 0b7aa1a97f68..dcb8d30e0ffa 100644
+index d836598927ce..fd1da6478fb2 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
-@@ -2392,15 +2392,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
+@@ -2391,15 +2391,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
const unsigned elementCount = vt->getNumElements();
llvm::SmallVector][ elems;
elems.reserve(elementCount);
@@ -33,7 +33,7 @@
}
ref<Expr> Result = ConcatExpr::createN(elementCount, elems.data());
-@@ -2430,12 +2426,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
+@@ -2429,12 +2425,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
return;
}
@@ -48,5 +48,5 @@
bindLocal(ki, state, Result);
break;
--
-2.15.0
+2.15.1
++++++ 0003-test-add-versions-of-some-tests-for-LLVM-3.7.patch ++++++
--- /var/tmp/diff_new_pack.3WQrfy/_old 2018-01-31 19:53:58.575660817 +0100
+++ /var/tmp/diff_new_pack.3WQrfy/_new 2018-01-31 19:53:58.575660817 +0100
@@ -1615,5 +1615,5 @@
+ return 0;
+}
--
-2.15.0
+2.15.1
++++++ 0004-Provide-errno-independent-of-CTYPE_EXTERNALS-being-d.patch ++++++
--- /var/tmp/diff_new_pack.3WQrfy/_old 2018-01-31 19:53:58.587660259 +0100
+++ /var/tmp/diff_new_pack.3WQrfy/_new 2018-01-31 19:53:58.587660259 +0100
@@ -11,7 +11,7 @@
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
-index dcb8d30e0ffa..dd3af9836187 100644
+index fd1da6478fb2..efc59008e542 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -524,14 +524,20 @@ void Executor::initializeGlobals(ExecutionState &state) {
@@ -39,5 +39,5 @@
These point into arrays of 384, so they can be indexed by any `unsigned
char' value [0,255]; by EOF (-1); or by any `signed char' value
--
-2.15.0
+2.15.1
++++++ 0004-llvm37-handle-getRegisteredOptions.patch ++++++
--- /var/tmp/diff_new_pack.3WQrfy/_old 2018-01-31 19:53:58.603659515 +0100
+++ /var/tmp/diff_new_pack.3WQrfy/_new 2018-01-31 19:53:58.603659515 +0100
@@ -29,5 +29,5 @@
i++) {
if (i->second->Category != &Category) {
--
-2.15.0
+2.15.1
++++++ 0005-Track-errno-correctly.patch ++++++
--- /var/tmp/diff_new_pack.3WQrfy/_old 2018-01-31 19:53:58.611659143 +0100
+++ /var/tmp/diff_new_pack.3WQrfy/_new 2018-01-31 19:53:58.615658956 +0100
@@ -15,7 +15,7 @@
4 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
-index dd3af9836187..3492cd7e9b3c 100644
+index efc59008e542..045e353ba932 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -531,7 +531,10 @@ void Executor::initializeGlobals(ExecutionState &state) {
@@ -30,7 +30,7 @@
#endif
// Disabled, we don't want to promote use of live externals.
-@@ -2973,6 +2976,27 @@ void Executor::callExternalFunction(ExecutionState &state,
+@@ -2999,6 +3002,27 @@ void Executor::callExternalFunction(ExecutionState &state,
return;
}
@@ -142,5 +142,5 @@
BitArray *concreteMask;
--
-2.15.0
+2.15.1
++++++ 0005-llvm-make-KLEE-compile-against-LLVM-3.8.patch ++++++
--- /var/tmp/diff_new_pack.3WQrfy/_old 2018-01-31 19:53:58.623658584 +0100
+++ /var/tmp/diff_new_pack.3WQrfy/_new 2018-01-31 19:53:58.623658584 +0100
@@ -15,10 +15,10 @@
7 files changed, 77 insertions(+), 9 deletions(-)
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
-index 3492cd7e9b3c..51531f8f46c8 100644
+index 045e353ba932..96d85f503d4f 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
-@@ -2136,8 +2136,13 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
+@@ -2135,8 +2135,13 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
!fpWidthToSemantics(right->getWidth()))
return terminateStateOnExecError(state, "Unsupported FRem operation");
llvm::APFloat Res(*fpWidthToSemantics(left->getWidth()), left->getAPValue());
@@ -78,7 +78,7 @@
Value *op2 = ii->getArgOperand(1);
diff --git a/lib/Module/LowerSwitch.cpp b/lib/Module/LowerSwitch.cpp
-index 1a194245a09a..b61da111908b 100644
+index 02f00a3ae94e..7fe9d9768d72 100644
--- a/lib/Module/LowerSwitch.cpp
+++ b/lib/Module/LowerSwitch.cpp
@@ -64,7 +64,11 @@ void LowerSwitchPass::switchConvert(CaseItr begin, CaseItr end,
@@ -248,7 +248,7 @@
addPass(Passes, createLICMPass()); // Hoist loop invariants
addPass(Passes, createGVNPass()); // Remove redundancies
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
-index f8706f9f74e5..dbc166ed158a 100644
+index ea24d89c5aaf..14afce0edf7c 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -291,7 +291,12 @@ KleeHandler::KleeHandler(int argc, char **argv)
@@ -266,5 +266,5 @@
// create directory and try to link klee-last
if (mkdir(d.c_str(), 0775) == 0) {
--
-2.15.0
+2.15.1
++++++ 0006-Declare-klee_get_errno-and-remove-local-declarations.patch ++++++
--- /var/tmp/diff_new_pack.3WQrfy/_old 2018-01-31 19:53:58.635658027 +0100
+++ /var/tmp/diff_new_pack.3WQrfy/_new 2018-01-31 19:53:58.635658027 +0100
@@ -5,18 +5,19 @@
Signed-off-by: Jiri Slaby
---
- include/klee/klee.h | 2 ++
+ include/klee/klee.h | 3 +++
runtime/POSIX/fd.c | 6 ------
- 2 files changed, 2 insertions(+), 6 deletions(-)
+ 2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/include/klee/klee.h b/include/klee/klee.h
-index bd3100b5007e..282670eebc91 100644
+index 644c498e94ab..8b9cd2e266d3 100644
--- a/include/klee/klee.h
+++ b/include/klee/klee.h
-@@ -152,6 +152,8 @@ extern "C" {
- /* Print range for given argument and tagged with name */
- void klee_print_range(const char * name, int arg );
+@@ -157,6 +157,9 @@ extern "C" {
+ /* Merge all paths of the state that went through klee_open_merge */
+ void klee_close_merge();
++
+ /* Get errno value of the current state */
+ int klee_get_errno(void);
#ifdef __cplusplus
@@ -40,5 +41,5 @@
static exe_disk_file_t *__get_sym_file(const char *pathname) {
if (!pathname)
--
-2.15.0
+2.15.1
++++++ 0006-llvm-make-KLEE-compile-against-LLVM-3.9.patch ++++++
--- /var/tmp/diff_new_pack.3WQrfy/_old 2018-01-31 19:53:58.643657655 +0100
+++ /var/tmp/diff_new_pack.3WQrfy/_new 2018-01-31 19:53:58.643657655 +0100
@@ -15,7 +15,7 @@
7 files changed, 98 insertions(+), 5 deletions(-)
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
-index 51531f8f46c8..cd36eeec13e1 100644
+index 96d85f503d4f..d7c3194d9de4 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -1308,10 +1308,18 @@ void Executor::executeCall(ExecutionState &state,
@@ -272,10 +272,10 @@
llvm::cl::ParseCommandLineOptions(argc, argv);
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
-index dbc166ed158a..3c78b480bb23 100644
+index 14afce0edf7c..436651f438d4 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
-@@ -1130,7 +1130,11 @@ int main(int argc, char **argv, char **envp) {
+@@ -1132,7 +1132,11 @@ int main(int argc, char **argv, char **envp) {
llvm::InitializeNativeTarget();
parseArguments(argc, argv);
@@ -288,5 +288,5 @@
if (Watchdog) {
if (MaxTime==0) {
--
-2.15.0
+2.15.1
++++++ 0007-Add-support-for-modelling-errno_location.patch ++++++
--- /var/tmp/diff_new_pack.3WQrfy/_old 2018-01-31 19:53:58.651657283 +0100
+++ /var/tmp/diff_new_pack.3WQrfy/_new 2018-01-31 19:53:58.655657097 +0100
@@ -5,16 +5,16 @@
Signed-off-by: Jiri Slaby
---
- lib/Core/SpecialFunctionHandler.cpp | 46 ++++++++++++++++++++++++++++++++++---
+ lib/Core/SpecialFunctionHandler.cpp | 44 +++++++++++++++++++++++++++++++++++--
lib/Core/SpecialFunctionHandler.h | 1 +
tools/klee/main.cpp | 2 ++
- 3 files changed, 46 insertions(+), 3 deletions(-)
+ 3 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/lib/Core/SpecialFunctionHandler.cpp b/lib/Core/SpecialFunctionHandler.cpp
-index 88e0d1a034bd..a019a09486c1 100644
+index a8d6edecdd91..267a262fc133 100644
--- a/lib/Core/SpecialFunctionHandler.cpp
+++ b/lib/Core/SpecialFunctionHandler.cpp
-@@ -89,6 +89,8 @@ static SpecialFunctionHandler::HandlerInfo handlerInfo[] = {
+@@ -91,6 +91,8 @@ static SpecialFunctionHandler::HandlerInfo handlerInfo[] = {
add("klee_define_fixed_object", handleDefineFixedObject, false),
add("klee_get_obj_size", handleGetObjSize, true),
add("klee_get_errno", handleGetErrno, true),
@@ -23,7 +23,7 @@
add("klee_is_symbolic", handleIsSymbolic, true),
add("klee_make_symbolic", handleMakeSymbolic, false),
add("klee_mark_global", handleMarkGlobal, false),
-@@ -537,10 +539,48 @@ void SpecialFunctionHandler::handleGetErrno(ExecutionState &state,
+@@ -578,10 +580,48 @@ void SpecialFunctionHandler::handleGetErrno(ExecutionState &state,
// XXX should type check args
assert(arguments.size()==0 &&
"invalid number of arguments to klee_get_errno");
@@ -47,8 +47,8 @@
+ executor.terminateStateOnError(state, "Could not resolve address for errno",
+ Executor::User);
+ executor.bindLocal(target, state, result.second->read(0, Expr::Int32));
-+}
-+
+ }
+
+void SpecialFunctionHandler::handleErrnoLocation(
+ ExecutionState &state, KInstruction *target,
+ std::vector][ &arguments) {
@@ -70,13 +70,12 @@
+ ConstantExpr::create((uint64_t)errno_addr,
+ executor.kmodule->targetData->getTypeSizeInBits(
+ target->inst->getType())));
- }
--
++}
void SpecialFunctionHandler::handleCalloc(ExecutionState &state,
KInstruction *target,
std::vector][ &arguments) {
diff --git a/lib/Core/SpecialFunctionHandler.h b/lib/Core/SpecialFunctionHandler.h
-index 394b649aff72..5e58ede4f328 100644
+index 7e58018f8366..b11a49749ccb 100644
--- a/lib/Core/SpecialFunctionHandler.h
+++ b/lib/Core/SpecialFunctionHandler.h
@@ -107,6 +107,7 @@ namespace klee {
@@ -88,7 +87,7 @@
HANDLER(handleFree);
HANDLER(handleGetErrno);
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
-index f1def38c90e5..4a820578bf16 100644
+index 2b2fe3eb06c8..9bdf06f600ce 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -698,6 +698,8 @@ static const char *modelledExternals[] = {
@@ -101,5 +100,5 @@
"_exit",
"exit",
--
-2.15.0
+2.15.1
++++++ 0013-llvm38-test-change-some-tests.patch -> 0007-llvm38-test-change-some-tests.patch ++++++
--- /work/SRC/openSUSE:Factory/klee/0013-llvm38-test-change-some-tests.patch 2017-11-27 22:17:07.393439464 +0100
+++ /work/SRC/openSUSE:Factory/.klee.new/0007-llvm38-test-change-some-tests.patch 2018-01-31 19:53:56.895738942 +0100
@@ -119,5 +119,5 @@
+ ret i32 0
+}
--
-2.15.0
+2.15.1
++++++ 0008-Cleanup-test-cases.patch ++++++
--- /var/tmp/diff_new_pack.3WQrfy/_old 2018-01-31 19:53:58.687655609 +0100
+++ /var/tmp/diff_new_pack.3WQrfy/_new 2018-01-31 19:53:58.687655609 +0100
@@ -38,5 +38,5 @@
#include
#include
--
-2.15.0
+2.15.1
++++++ 0007-llvm40-handle-different-header-names.patch -> 0008-llvm40-handle-different-header-names.patch ++++++
--- /work/SRC/openSUSE:Factory/klee/0007-llvm40-handle-different-header-names.patch 2017-11-27 22:17:07.257444401 +0100
+++ /work/SRC/openSUSE:Factory/.klee.new/0008-llvm40-handle-different-header-names.patch 2018-01-31 19:53:57.327718852 +0100
@@ -59,7 +59,7 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Path.h"
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
-index 3c78b480bb23..d45fad22896f 100644
+index 436651f438d4..07f302a4641f 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -31,7 +31,6 @@
@@ -84,5 +84,5 @@
#include
#include
--
-2.15.0
+2.15.1
++++++ 0008-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch -> 0009-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch ++++++
--- /work/SRC/openSUSE:Factory/klee/0008-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch 2017-11-27 22:17:07.285443385 +0100
+++ /work/SRC/openSUSE:Factory/.klee.new/0009-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch 2018-01-31 19:53:57.403715318 +0100
@@ -9,7 +9,7 @@
1 file changed, 9 insertions(+)
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
-index cd36eeec13e1..af7f680fec3d 100644
+index d7c3194d9de4..19499e1be37d 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -1451,12 +1451,21 @@ static bool isDebugIntrinsic(const Function *f, KModule *KM) {
@@ -35,5 +35,5 @@
return 0;
}
--
-2.15.0
+2.15.1
++++++ 0009-test-fix-Feature-BFSSearcherAndDFSSearcherInterleave.patch ++++++
--- /var/tmp/diff_new_pack.3WQrfy/_old 2018-01-31 19:53:58.731653562 +0100
+++ /var/tmp/diff_new_pack.3WQrfy/_new 2018-01-31 19:53:58.731653562 +0100
@@ -31,5 +31,5 @@
+ // CHECK: {{^(ABCD|ABDC|ACBD|ACDB|ADBC|ADCB|BACD|BADC|BCAD|BCDA|BDAC|BDCA|CABD|CADB|CBAD|CBDA|CDAB|CDBA|DABC|DACB|DBAC|DBCA|DCAB|DCBA)$}}
}
--
-2.15.0
+2.15.1
++++++ 0009-llvm40-errorOr-and-similar.patch -> 0010-llvm40-errorOr-and-similar.patch ++++++
--- /work/SRC/openSUSE:Factory/klee/0009-llvm40-errorOr-and-similar.patch 2017-11-27 22:17:07.305442659 +0100
+++ /work/SRC/openSUSE:Factory/.klee.new/0010-llvm40-errorOr-and-similar.patch 2018-01-31 19:53:57.455712900 +0100
@@ -124,5 +124,5 @@
#else
if (auto ec = module->materializeAllPermanently()) {
--
-2.15.0
+2.15.1
++++++ 0010-llvm-use-chrono-helpers-from-LLVM-4.0.patch -> 0011-llvm-use-chrono-helpers-from-LLVM-4.0.patch ++++++
--- /work/SRC/openSUSE:Factory/klee/0010-llvm-use-chrono-helpers-from-LLVM-4.0.patch 2017-11-27 22:17:07.349441061 +0100
+++ /work/SRC/openSUSE:Factory/.klee.new/0011-llvm-use-chrono-helpers-from-LLVM-4.0.patch 2018-01-31 19:53:57.475711970 +0100
@@ -4,7 +4,7 @@
Patch-mainline: no
LLVM 4.0 removes the old time interface and starts using the C++11's
-chrono. So swiych to that in klee for LLVM 4.0 too.
+chrono. So switch to that in klee for LLVM 4.0 too.
Signed-off-by: Jiri Slaby
---
@@ -195,5 +195,5 @@
+
+#endif
--
-2.15.0
+2.15.1
++++++ 0011-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch -> 0012-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch ++++++
--- /work/SRC/openSUSE:Factory/klee/0011-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch 2017-11-27 22:17:07.361440626 +0100
+++ /work/SRC/openSUSE:Factory/.klee.new/0012-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch 2018-01-31 19:53:57.503710668 +0100
@@ -27,10 +27,10 @@
CurTy = 0;
}
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
-index af7f680fec3d..f435f5389f64 100644
+index 19499e1be37d..093be697c7da 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
-@@ -2520,8 +2520,7 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) {
+@@ -2522,8 +2522,7 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) {
uint64_t addend = sl->getElementOffset((unsigned) ci->getZExtValue());
constantOffset = constantOffset->Add(ConstantExpr::alloc(addend,
Context::get().getPointerWidth()));
@@ -40,7 +40,7 @@
uint64_t elementSize =
kmodule->targetData->getTypeStoreSize(set->getElementType());
Value *operand = ii.getOperand();
-@@ -2535,7 +2534,24 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) {
+@@ -2537,7 +2536,24 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) {
} else {
kgepi->indices.push_back(std::make_pair(index, elementSize));
}
@@ -67,5 +67,5 @@
}
kgepi->offset = constantOffset->getZExtValue();
--
-2.15.0
+2.15.1
++++++ 0012-llvm40-gep_type_iterator-has-no-operator.patch -> 0013-llvm40-gep_type_iterator-has-no-operator.patch ++++++
--- /work/SRC/openSUSE:Factory/klee/0012-llvm40-gep_type_iterator-has-no-operator.patch 2017-11-27 22:17:07.377440045 +0100
+++ /work/SRC/openSUSE:Factory/.klee.new/0013-llvm40-gep_type_iterator-has-no-operator.patch 2018-01-31 19:53:57.519709924 +0100
@@ -28,5 +28,5 @@
const StructLayout *SL = kmodule->targetData->getStructLayout(STy);
base = base->Add(
--
-2.15.0
+2.15.1
++++++ 0014-llvm50-avoid-on-function-arg_begin.patch ++++++
From: Jiri Slaby
Date: Mon, 15 Jan 2018 10:35:19 +0100
Subject: llvm50: avoid ++ on function->arg_begin()
Patch-mainline: no
Starting with llvm 5, arguments of a function are not an iterator, but
an array. So they cannot be incremented in-place. Use +1 to construct a
new one instead.
Otherwise we see:
../tools/klee/main.cpp:661:23: error: expression is not assignable
Value *oldArgv = &*(++mainFn->arg_begin());
^ ~~~~~~~~~~~~~~~~~~~
Signed-off-by: Jiri Slaby
---
tools/klee/main.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 07f302a4641f..aeed018631ea 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -658,7 +658,11 @@ static int initEnv(Module *mainModule) {
Instruction *firstInst = &*(mainFn->begin()->begin());
Value *oldArgc = &*(mainFn->arg_begin());
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
+ Value *oldArgv = &*(mainFn->arg_begin() + 1);
+#else
Value *oldArgv = &*(++mainFn->arg_begin());
+#endif
AllocaInst* argcPtr =
new AllocaInst(oldArgc->getType(), "argcPtr", firstInst);
@@ -1117,7 +1121,11 @@ static llvm::Module *linkWithUclibc(llvm::Module *mainModule, StringRef libDir)
args.push_back(llvm::ConstantExpr::getBitCast(userMainFn,
ft->getParamType(0)));
args.push_back(&*(stub->arg_begin())); // argc
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
+ args.push_back(&*(stub->arg_begin() + 1)); // argv
+#else
args.push_back(&*(++stub->arg_begin())); // argv
+#endif
args.push_back(Constant::getNullValue(ft->getParamType(3))); // app_init
args.push_back(Constant::getNullValue(ft->getParamType(4))); // app_fini
args.push_back(Constant::getNullValue(ft->getParamType(5))); // rtld_fini
--
2.15.1
++++++ 0015-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch ++++++
From: Jiri Slaby
Date: Mon, 15 Jan 2018 10:09:20 +0100
Subject: llvm50: integerPartWidth is from llvm::APFloatBase
Patch-mainline: no
Otherwise we see:
../lib/Expr/Expr.cpp:331:14: error: no member named 'integerPartWidth' in namespace 'llvm'; did you mean 'llvm::APFloatBase::integerPartWidth'?
Signed-off-by: Jiri Slaby
---
lib/Expr/Expr.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp
index f73d1614c250..5433d9211ead 100644
--- a/lib/Expr/Expr.cpp
+++ b/lib/Expr/Expr.cpp
@@ -328,7 +328,11 @@ ref<Expr> ConstantExpr::fromMemory(void *address, Width width) {
// FIXME: what about machines without x87 support?
default:
return ConstantExpr::alloc(llvm::APInt(width,
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
+ (width+llvm::APFloatBase::integerPartWidth-1)/llvm::APFloatBase::integerPartWidth,
+#else
(width+llvm::integerPartWidth-1)/llvm::integerPartWidth,
+#endif
(const uint64_t*)address));
}
}
--
2.15.1
++++++ 0016-llvm50-handle-getOrInsertFunction-terminator.patch ++++++
From: Jiri Slaby
Date: Mon, 15 Jan 2018 10:27:54 +0100
Subject: llvm50: handle getOrInsertFunction terminator
Patch-mainline: no
llvm 5 does not terminate getOrInsertFunction parameters with NULL, take
care of that.
Since commit 9d54400bba7eb04bca80fce97fa170452d19eaf1.
Signed-off-by: Jiri Slaby
---
include/klee/Config/Version.h | 6 ++++++
lib/Module/Checks.cpp | 8 ++++----
lib/Module/IntrinsicCleaner.cpp | 2 +-
tools/klee/main.cpp | 20 ++++++++++----------
4 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/include/klee/Config/Version.h b/include/klee/Config/Version.h
index 532051602fe3..a02ce28baaae 100644
--- a/include/klee/Config/Version.h
+++ b/include/klee/Config/Version.h
@@ -27,4 +27,10 @@
# define KLEE_LLVM_CL_VAL_END , clEnumValEnd
#endif
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
+# define KLEE_LLVM_GOIF_TERMINATOR
+#else
+# define KLEE_LLVM_GOIF_TERMINATOR , NULL
+#endif
+
#endif
diff --git a/lib/Module/Checks.cpp b/lib/Module/Checks.cpp
index aac63e1d9854..406b3045e527 100644
--- a/lib/Module/Checks.cpp
+++ b/lib/Module/Checks.cpp
@@ -57,8 +57,8 @@ bool DivCheckPass::runOnModule(Module &M) {
if (!divZeroCheckFunction) {
Constant *fc = M.getOrInsertFunction("klee_div_zero_check",
Type::getVoidTy(ctx),
- Type::getInt64Ty(ctx),
- NULL);
+ Type::getInt64Ty(ctx)
+ KLEE_LLVM_GOIF_TERMINATOR);
divZeroCheckFunction = cast<Function>(fc);
}
@@ -118,8 +118,8 @@ bool OvershiftCheckPass::runOnModule(Module &M) {
Constant *fc = M.getOrInsertFunction("klee_overshift_check",
Type::getVoidTy(ctx),
Type::getInt64Ty(ctx),
- Type::getInt64Ty(ctx),
- NULL);
+ Type::getInt64Ty(ctx)
+ KLEE_LLVM_GOIF_TERMINATOR);
overshiftCheckFunction = cast<Function>(fc);
}
diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp
index 2b93319f2615..c00c77699e18 100644
--- a/lib/Module/IntrinsicCleaner.cpp
+++ b/lib/Module/IntrinsicCleaner.cpp
@@ -208,7 +208,7 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) {
// a call of the abort() function.
Function *F = cast<Function>(
M.getOrInsertFunction(
- "abort", Type::getVoidTy(ctx), NULL));
+ "abort", Type::getVoidTy(ctx) KLEE_LLVM_GOIF_TERMINATOR));
F->setDoesNotReturn();
F->setDoesNotThrow();
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index aeed018631ea..02748fbc0ee5 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -678,8 +678,8 @@ static int initEnv(Module *mainModule) {
cast<Function>(mainModule->getOrInsertFunction("klee_init_env",
Type::getVoidTy(ctx),
argcPtr->getType(),
- argvPtr->getType(),
- NULL));
+ argvPtr->getType()
+ KLEE_LLVM_GOIF_TERMINATOR));
assert(initEnvFn);
std::vector args;
args.push_back(argcPtr);
@@ -1038,20 +1038,20 @@ static llvm::Module *linkWithUclibc(llvm::Module *mainModule, StringRef libDir)
mainModule->getOrInsertFunction("realpath",
PointerType::getUnqual(i8Ty),
PointerType::getUnqual(i8Ty),
- PointerType::getUnqual(i8Ty),
- NULL);
+ PointerType::getUnqual(i8Ty)
+ KLEE_LLVM_GOIF_TERMINATOR);
mainModule->getOrInsertFunction("getutent",
- PointerType::getUnqual(i8Ty),
- NULL);
+ PointerType::getUnqual(i8Ty)
+ KLEE_LLVM_GOIF_TERMINATOR);
mainModule->getOrInsertFunction("__fgetc_unlocked",
Type::getInt32Ty(ctx),
- PointerType::getUnqual(i8Ty),
- NULL);
+ PointerType::getUnqual(i8Ty)
+ KLEE_LLVM_GOIF_TERMINATOR);
mainModule->getOrInsertFunction("__fputc_unlocked",
Type::getInt32Ty(ctx),
Type::getInt32Ty(ctx),
- PointerType::getUnqual(i8Ty),
- NULL);
+ PointerType::getUnqual(i8Ty)
+ KLEE_LLVM_GOIF_TERMINATOR);
}
f = mainModule->getFunction("__ctype_get_mb_cur_max");
--
2.15.1
++++++ 0017-llvm50-SwitchInst-case-functions-now-return-pointers.patch ++++++
From: Jiri Slaby
Date: Mon, 15 Jan 2018 10:38:35 +0100
Subject: llvm50: SwitchInst case functions now return pointers
Patch-mainline: no
Starting llvm 5, SwitchInst->findCaseValue() now has to be dereferenced
using ->. So do so, otherwise we see:
../lib/Core/Executor.cpp:1598:38: error: no member named 'getCaseSuccessor' in 'llvm::SwitchInst::CaseIteratorImplllvm::SwitchInst::CaseHandle'; did you mean to use '->' instead of '.'?
BasicBlock *caseSuccessor = i.getCaseSuccessor();
^
Signed-off-by: Jiri Slaby
---
lib/Core/Executor.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 093be697c7da..5fe5bf9c1346 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -1571,7 +1571,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
// switch to an internal rep.
llvm::IntegerType *Ty = cast<IntegerType>(si->getCondition()->getType());
ConstantInt *ci = ConstantInt::get(Ty, CE->getZExtValue());
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
+ unsigned index = si->findCaseValue(ci)->getSuccessorIndex();
+#else
unsigned index = si->findCaseValue(ci).getSuccessorIndex();
+#endif
transferToBasicBlock(si->getSuccessor(index), si->getParent(), state);
} else {
// Handle possible different branch targets
--
2.15.1
++++++ 0018-llvm50-handle-new-file_magic-s-location.patch ++++++
From: Jiri Slaby
Date: Mon, 15 Jan 2018 10:42:53 +0100
Subject: llvm50: handle new file_magic's location
Patch-mainline: no
llvm 5, moved file_magic to BinaryFormat in commit
19ca2b0f9daed883c21730285d7f04424e5f5f88, so adapt to that.
Signed-off-by: Jiri Slaby
`
Signed-off-by: Jiri Slaby
---
lib/Module/ModuleUtil.cpp | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp
index ad847de0b368..5f967410568c 100644
--- a/lib/Module/ModuleUtil.cpp
+++ b/lib/Module/ModuleUtil.cpp
@@ -14,6 +14,9 @@
#include "klee/Internal/Support/ErrorHandling.h"
#include "../Core/SpecialFunctionHandler.h"
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
+#include "llvm/BinaryFormat/Magic.h"
+#endif
#include "llvm/IRReader/IRReader.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instructions.h"
@@ -477,7 +480,9 @@ Module *klee::linkWithLibrary(Module *module,
MemoryBuffer *Buffer = bufferErr->get();
#endif
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
+ file_magic magic = identify_magic(Buffer.getBuffer());
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
sys::fs::file_magic magic = sys::fs::identify_magic(Buffer.getBuffer());
#else
sys::fs::file_magic magic = sys::fs::identify_magic(Buffer->getBuffer());
@@ -486,7 +491,11 @@ Module *klee::linkWithLibrary(Module *module,
LLVMContext &Context = module->getContext();
std::string ErrorMessage;
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
+ if (magic == file_magic::bitcode) {
+#else
if (magic == sys::fs::file_magic::bitcode) {
+#endif
#if LLVM_VERSION_CODE < LLVM_VERSION(3, 8)
Module *Result = 0;
#endif
@@ -538,7 +547,11 @@ Module *klee::linkWithLibrary(Module *module,
delete Result;
#endif
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
+ } else if (magic == file_magic::archive) {
+#else
} else if (magic == sys::fs::file_magic::archive) {
+#endif
#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
Expectedobject::Binary > arch =
object::createBinary(Buffer, &Context);
--
2.15.1
++++++ 0019-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch ++++++
From: Jiri Slaby
Date: Mon, 15 Jan 2018 11:07:47 +0100
Subject: llvm50: use MutableArrayRef for APFloat::convertToInteger
Patch-mainline: no
in llvm 5, since commit 957caa243d9270df37a566aedae3f1244e7b62ef, the
first parameter to APFloat::convertToInteger is MutableArrayRef. So
handle that.
Signed-off-by: Jiri Slaby
---
lib/Core/Executor.cpp | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 5fe5bf9c1346..44293f885136 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -2219,7 +2219,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
llvm::APFloat Arg(*fpWidthToSemantics(arg->getWidth()), arg->getAPValue());
uint64_t value = 0;
bool isExact = true;
- Arg.convertToInteger(&value, resultType, false,
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
+ MutableArrayRef valueRef = makeMutableArrayRef(value);
+#else
+ uint64_t *valueRef = &value;
+#endif
+ Arg.convertToInteger(valueRef, resultType, false,
llvm::APFloat::rmTowardZero, &isExact);
bindLocal(ki, state, ConstantExpr::alloc(value, resultType));
break;
@@ -2236,7 +2241,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
uint64_t value = 0;
bool isExact = true;
- Arg.convertToInteger(&value, resultType, true,
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
+ MutableArrayRef valueRef = makeMutableArrayRef(value);
+#else
+ uint64_t *valueRef = &value;
+#endif
+ Arg.convertToInteger(valueRef, resultType, true,
llvm::APFloat::rmTowardZero, &isExact);
bindLocal(ki, state, ConstantExpr::alloc(value, resultType));
break;
--
2.15.1
++++++ 0020-llvm50-AllocaInst-takes-address-space.patch ++++++
From: Jiri Slaby
Date: Mon, 15 Jan 2018 11:10:39 +0100
Subject: llvm50: AllocaInst takes address space
Patch-mainline: no
Add address space second parameter to new AllocaInst which is required
since llvm 5's commit e0b3c335a27ae50c4f339ffb81c18662bc983e52.
Signed-off-by: Jiri Slaby
---
tools/klee/main.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 02748fbc0ee5..30100b19af3b 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -664,10 +664,18 @@ static int initEnv(Module *mainModule) {
Value *oldArgv = &*(++mainFn->arg_begin());
#endif
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
+ const DataLayout &DL = mainFn->getParent()->getDataLayout();
+ AllocaInst* argcPtr =
+ new AllocaInst(oldArgc->getType(), DL.getAllocaAddrSpace(), "argcPtr", firstInst);
+ AllocaInst* argvPtr =
+ new AllocaInst(oldArgv->getType(), DL.getAllocaAddrSpace(), "argvPtr", firstInst);
+#else
AllocaInst* argcPtr =
new AllocaInst(oldArgc->getType(), "argcPtr", firstInst);
AllocaInst* argvPtr =
new AllocaInst(oldArgv->getType(), "argvPtr", firstInst);
+#endif
/* Insert void klee_init_env(int* argc, char*** argv) */
std::vector params;
--
2.15.1
++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.3WQrfy/_old 2018-01-31 19:53:58.971642402 +0100
+++ /var/tmp/diff_new_pack.3WQrfy/_new 2018-01-31 19:53:58.971642402 +0100
@@ -1,4 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">git://github.com/klee/klee.git</param>
- <param name="changesrevision">9caaae0b1b6e52be3c7bb783f3a8be659a1a1869</param></service></servicedata>
\ No newline at end of file
+ <param name="changesrevision">37f554d5cf587ec9f6befa359a0e3aa60e9ce73f</param></service></servicedata>
\ No newline at end of file
++++++ klee-1.4.0+20171026.tar.xz -> klee-1.4.0+20180108.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/.travis.yml new/klee-1.4.0+20180108/.travis.yml
--- old/klee-1.4.0+20171026/.travis.yml 2017-10-26 16:50:55.000000000 +0200
+++ new/klee-1.4.0+20180108/.travis.yml 2018-01-08 12:09:12.000000000 +0100
@@ -77,7 +77,7 @@
matrix:
include:
- os: osx
- osx_image: xcode8.2
+ osx_image: xcode8.3
env: LLVM_VERSION=3.4 SOLVERS=STP:Z3 STP_VERSION=2.1.2 KLEE_UCLIBC=0 DISABLE_ASSERTIONS=0 ENABLE_OPTIMIZED=1 COVERAGE=0 USE_TCMALLOC=0
addons:
@@ -107,7 +107,7 @@
###########################################################################
# Update package information
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update; fi
- - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update && brew tap andreamattavelli/klee; fi
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update && brew tap klee/klee; fi
###########################################################################
# Set up out of source build directory
###########################################################################
@@ -123,7 +123,7 @@
- ${KLEE_SRC}/.travis/install-llvm-and-runtime-compiler.sh
- ${KLEE_SRC}/.travis/install-tcmalloc.sh
# Install lit (llvm-lit is not available)
- - sudo pip install lit
+ - sudo pip2 install lit
# Get SMT solvers
- ${KLEE_SRC}/.travis/solvers.sh
# Get needed utlities/libraries for testing KLEE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/include/klee/Config/config.h.in new/klee-1.4.0+20180108/include/klee/Config/config.h.in
--- old/klee-1.4.0+20171026/include/klee/Config/config.h.in 2017-10-26 16:50:55.000000000 +0200
+++ new/klee-1.4.0+20180108/include/klee/Config/config.h.in 1970-01-01 01:00:00.000000000 +0100
@@ -1,118 +0,0 @@
-/* include/klee/Config/config.h.in. Generated from autoconf/configure.tmp.ac by autoheader. */
-
-#ifndef KLEE_CONFIG_CONFIG_H
-#define KLEE_CONFIG_CONFIG_H
-
-/* Enable KLEE DEBUG checks */
-#undef ENABLE_KLEE_DEBUG
-
-/* Enable metaSMT API */
-#undef ENABLE_METASMT
-
-/* Using STP Solver backend */
-#undef ENABLE_STP
-
-/* Using Z3 Solver backend */
-#undef ENABLE_Z3
-
-/* Does the platform use __ctype_b_loc, etc. */
-#undef HAVE_CTYPE_EXTERNALS
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_GPERFTOOLS_MALLOC_EXTENSION_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define if mallinfo() is available on this platform. */
-#undef HAVE_MALLINFO
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_MALLOC_MALLOC_H
-
-/* Define to 1 if you have the `malloc_zone_statistics' function. */
-#undef HAVE_MALLOC_ZONE_STATISTICS
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SELINUX_SELINUX_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SYS_ACL_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SYS_CAPABILITY_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_UNISTD_H
-
-/* Z3 needs a Z3_context passed to Z3_get_error_msg() */
-#undef HAVE_Z3_GET_ERROR_MSG_NEEDS_CONTEXT
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_ZLIB_H
-
-/* Enable time stamping the sources */
-#undef KLEE_ENABLE_TIMESTAMP
-
-/* Define to empty or 'const' depending on how SELinux qualifies its security
- context parameters. */
-#undef KLEE_SELINUX_CTX_CONST
-
-/* LLVM version is release (instead of development) */
-#undef LLVM_IS_RELEASE
-
-/* LLVM major version number */
-#undef LLVM_VERSION_MAJOR
-
-/* LLVM minor version number */
-#undef LLVM_VERSION_MINOR
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Configuration for runtime libraries */
-#undef RUNTIME_CONFIGURATION
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* klee-uclibc is supported */
-#undef SUPPORT_KLEE_UCLIBC
-
-#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/include/klee/ExecutionState.h new/klee-1.4.0+20180108/include/klee/ExecutionState.h
--- old/klee-1.4.0+20171026/include/klee/ExecutionState.h 2017-10-26 16:50:55.000000000 +0200
+++ new/klee-1.4.0+20180108/include/klee/ExecutionState.h 2018-01-08 12:09:12.000000000 +0100
@@ -13,6 +13,7 @@
#include "klee/Constraints.h"
#include "klee/Expr.h"
#include "klee/Internal/ADT/TreeStream.h"
+#include "klee/MergeHandler.h"
// FIXME: We do not want to be exposing these? :(
#include "../../lib/Core/AddressSpace.h"
@@ -145,6 +146,9 @@
void addFnAlias(std::string old_fn, std::string new_fn);
void removeFnAlias(std::string fn);
+ // The objects handling the klee_open_merge calls this state ran through
+ std::vector][ openMergeStack;
+
private:
ExecutionState() : ptreeNode(0) {}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/include/klee/MergeHandler.h new/klee-1.4.0+20180108/include/klee/MergeHandler.h
--- old/klee-1.4.0+20171026/include/klee/MergeHandler.h 1970-01-01 01:00:00.000000000 +0100
+++ new/klee-1.4.0+20180108/include/klee/MergeHandler.h 2018-01-08 12:09:12.000000000 +0100
@@ -0,0 +1,110 @@
+//===-- MergeHandler.h --------------------------------------------*- C++ -*-===//
+//
+// The KLEE Symbolic Virtual Machine
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+/**
+ * @file MergeHandler.h
+ * @brief Implementation of the region based merging
+ *
+ * ## Basic usage:
+ *
+ * @code{.cpp}
+ * klee_open_merge();
+ *
+ * code containing branches etc.
+ *
+ * klee_close_merge();
+ * @endcode
+ *
+ * Will lead to all states that forked from the state that executed the
+ * klee_open_merge() being merged in the klee_close_merge(). This allows for
+ * fine-grained regions to be specified for merging.
+ *
+ * # Implementation Structure
+ *
+ * The main part of the new functionality is implemented in the class
+ * klee::MergeHandler. The Special Function Handler generates an instance of
+ * this class every time a state runs into a klee_open_merge() call.
+ *
+ * This instance is appended to a `std::vectorklee::MergeHandler>`
+ * in the ExecutionState that passed the merge open point. This stack is also
+ * copied during forks. We use a stack instead of a single instance to support
+ * nested merge regions.
+ *
+ * Once a state runs into a `klee_close_merge()`, the Special Function Handler
+ * notifies the top klee::MergeHandler in the state's stack, pauses the state
+ * from scheduling, and tries to merge it with all other states that already
+ * arrived at the same close merge point. This top instance is then popped from
+ * the stack, resulting in a decrease of the ref count of the
+ * klee::MergeHandler.
+ *
+ * Since the only references to this MergeHandler are in the stacks of
+ * the ExecutionStates currently in the merging region, once the ref count
+ * reaches zero, every state which ran into the same `klee_open_merge()` is now
+ * paused and waiting to be merged. The destructor of the MergeHandler
+ * then continues the scheduling of the corresponding paused states.
+*/
+
+#ifndef KLEE_MERGEHANDLER_H
+#define KLEE_MERGEHANDLER_H
+
+#include <vector>
+#include <map>
+#include
+#include "llvm/Support/CommandLine.h"
+
+namespace llvm {
+class Instruction;
+}
+
+namespace klee {
+extern llvm::cl::opt<bool> UseMerge;
+
+extern llvm::cl::opt<bool> DebugLogMerge;
+
+class Executor;
+class ExecutionState;
+
+/// @brief Represents one `klee_open_merge()` call.
+/// Handles merging of states that branched from it
+class MergeHandler {
+private:
+ Executor *executor;
+
+ /// @brief Number of states that are tracked by this MergeHandler, that ran
+ /// into a relevant klee_close_merge
+ unsigned closedStateCount;
+
+ /// @brief Mapping the different 'klee_close_merge' calls to the states that ran into
+ /// them
+ std::map >
+ reachedMergeClose;
+
+public:
+
+ /// @brief Called when a state runs into a 'klee_close_merge()' call
+ void addClosedState(ExecutionState *es, llvm::Instruction *mp);
+
+ /// @brief True, if any states have run into 'klee_close_merge()' and have
+ /// not been released yet
+ bool hasMergedStates();
+
+ /// @brief Immediately release the merged states that have run into a
+ /// 'klee_merge_close()'
+ void releaseStates();
+
+ /// @brief Required by klee::ref objects
+ unsigned refCount;
+
+
+ MergeHandler(Executor *_executor);
+ ~MergeHandler();
+};
+}
+
+#endif /* KLEE_MERGEHANDLER_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/include/klee/klee.h new/klee-1.4.0+20180108/include/klee/klee.h
--- old/klee-1.4.0+20171026/include/klee/klee.h 2017-10-26 16:50:55.000000000 +0200
+++ new/klee-1.4.0+20180108/include/klee/klee.h 2018-01-08 12:09:12.000000000 +0100
@@ -152,6 +152,11 @@
/* Print range for given argument and tagged with name */
void klee_print_range(const char * name, int arg );
+ /* Open a merge */
+ void klee_open_merge();
+
+ /* Merge all paths of the state that went through klee_open_merge */
+ void klee_close_merge();
#ifdef __cplusplus
}
#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/lib/Core/CMakeLists.txt new/klee-1.4.0+20180108/lib/Core/CMakeLists.txt
--- old/klee-1.4.0+20171026/lib/Core/CMakeLists.txt 2017-10-26 16:50:55.000000000 +0200
+++ new/klee-1.4.0+20180108/lib/Core/CMakeLists.txt 2018-01-08 12:09:12.000000000 +0100
@@ -8,6 +8,7 @@
#===------------------------------------------------------------------------===#
klee_add_component(kleeCore
AddressSpace.cpp
+ MergeHandler.cpp
CallPathManager.cpp
Context.cpp
CoreStats.cpp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/lib/Core/ExecutionState.cpp new/klee-1.4.0+20180108/lib/Core/ExecutionState.cpp
--- old/klee-1.4.0+20171026/lib/Core/ExecutionState.cpp 2017-10-26 16:50:55.000000000 +0200
+++ new/klee-1.4.0+20180108/lib/Core/ExecutionState.cpp 2018-01-08 12:09:12.000000000 +0100
@@ -116,7 +116,8 @@
coveredLines(state.coveredLines),
ptreeNode(state.ptreeNode),
symbolics(state.symbolics),
- arrayNames(state.arrayNames)
+ arrayNames(state.arrayNames),
+ openMergeStack(state.openMergeStack)
{
for (unsigned int i=0; irefCount++;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/lib/Core/Executor.cpp new/klee-1.4.0+20180108/lib/Core/Executor.cpp
--- old/klee-1.4.0+20171026/lib/Core/Executor.cpp 2017-10-26 16:50:55.000000000 +0200
+++ new/klee-1.4.0+20180108/lib/Core/Executor.cpp 2018-01-08 12:09:12.000000000 +0100
@@ -2456,6 +2456,9 @@
void Executor::updateStates(ExecutionState *current) {
if (searcher) {
searcher->update(current, addedStates, removedStates);
+ searcher->update(nullptr, continuedStates, pausedStates);
+ pausedStates.clear();
+ continuedStates.clear();
}
states.insert(addedStates.begin(), addedStates.end());
@@ -2741,6 +2744,30 @@
return info.str();
}
+void Executor::pauseState(ExecutionState &state){
+ auto it = std::find(continuedStates.begin(), continuedStates.end(), &state);
+ // If the state was to be continued, but now gets paused again
+ if (it != continuedStates.end()){
+ // ...just don't continue it
+ std::swap(*it, continuedStates.back());
+ continuedStates.pop_back();
+ } else {
+ pausedStates.push_back(&state);
+ }
+}
+
+void Executor::continueState(ExecutionState &state){
+ auto it = std::find(pausedStates.begin(), pausedStates.end(), &state);
+ // If the state was to be paused, but now gets continued again
+ if (it != pausedStates.end()){
+ // ...don't pause it
+ std::swap(*it, pausedStates.back());
+ pausedStates.pop_back();
+ } else {
+ continuedStates.push_back(&state);
+ }
+}
+
void Executor::terminateState(ExecutionState &state) {
if (replayKTest && replayPosition!=replayKTest->numObjects) {
klee_warning_once(replayKTest,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/lib/Core/Executor.h new/klee-1.4.0+20180108/lib/Core/Executor.h
--- old/klee-1.4.0+20171026/lib/Core/Executor.h 2017-10-26 16:50:55.000000000 +0200
+++ new/klee-1.4.0+20180108/lib/Core/Executor.h 2018-01-08 12:09:12.000000000 +0100
@@ -69,6 +69,7 @@
class StatsTracker;
class TimingSolver;
class TreeStreamWriter;
+ class MergeHandler;
template<class T> class ref;
@@ -78,13 +79,12 @@
/// removedStates, and haltExecution, among others.
class Executor : public Interpreter {
- friend class BumpMergingSearcher;
- friend class MergingSearcher;
friend class RandomPathSearcher;
friend class OwningSearcher;
friend class WeightedRandomSearcher;
friend class SpecialFunctionHandler;
friend class StatsTracker;
+ friend class MergeHandler;
public:
class Timer {
@@ -144,6 +144,13 @@
/// \invariant \ref addedStates and \ref removedStates are disjoint.
std::vector removedStates;
+ /// Used to track states that are not terminated, but should not
+ /// be scheduled by the searcher.
+ std::vector pausedStates;
+ /// States that were 'paused' from scheduling, that now may be
+ /// scheduled again
+ std::vector continuedStates;
+
/// When non-empty the Executor is running in "seed" mode. The
/// states in this map will be executed in an arbitrary order
/// (outside the normal search interface) until they terminate. When
@@ -389,6 +396,10 @@
bool shouldExitOn(enum TerminateReason termReason);
+ // remove state from searcher only
+ void pauseState(ExecutionState& state);
+ // add state to searcher only
+ void continueState(ExecutionState& state);
// remove state from queue and delete
void terminateState(ExecutionState &state);
// call exit handler and terminate state
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/lib/Core/MergeHandler.cpp new/klee-1.4.0+20180108/lib/Core/MergeHandler.cpp
--- old/klee-1.4.0+20171026/lib/Core/MergeHandler.cpp 1970-01-01 01:00:00.000000000 +0100
+++ new/klee-1.4.0+20180108/lib/Core/MergeHandler.cpp 2018-01-08 12:09:12.000000000 +0100
@@ -0,0 +1,76 @@
+//===-- MergeHandler.cpp --------------------------------------------------===//
+//
+// The KLEE Symbolic Virtual Machine
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "klee/MergeHandler.h"
+
+#include "CoreStats.h"
+#include "Executor.h"
+#include "klee/ExecutionState.h"
+
+namespace klee {
+llvm::cl::opt<bool>
+ UseMerge("use-merge",
+ llvm::cl::init(false),
+ llvm::cl::desc("Enable support for klee_open_merge() and klee_close_merge() (experimental)"));
+
+llvm::cl::opt<bool>
+ DebugLogMerge("debug-log-merge",
+ llvm::cl::init(false),
+ llvm::cl::desc("Enhanced verbosity for region based merge operations"));
+
+void MergeHandler::addClosedState(ExecutionState *es,
+ llvm::Instruction *mp) {
+ auto closePoint = reachedMergeClose.find(mp);
+
+ // If no other state has yet encountered this klee_close_merge instruction,
+ // add a new element to the map
+ if (closePoint == reachedMergeClose.end()) {
+ reachedMergeClose[mp].push_back(es);
+ executor->pauseState(*es);
+ } else {
+ // Otherwise try to merge with any state in the map element for this
+ // instruction
+ auto &cpv = closePoint->second;
+ bool mergedSuccessful = false;
+
+ for (auto& mState: cpv) {
+ if (mState->merge(*es)) {
+ executor->terminateState(*es);
+ mergedSuccessful = true;
+ break;
+ }
+ }
+ if (!mergedSuccessful) {
+ cpv.push_back(es);
+ executor->pauseState(*es);
+ }
+ }
+}
+
+void MergeHandler::releaseStates() {
+ for (auto& curMergeGroup: reachedMergeClose) {
+ for (auto curState: curMergeGroup.second) {
+ executor->continueState(*curState);
+ }
+ }
+ reachedMergeClose.clear();
+}
+
+bool MergeHandler::hasMergedStates() {
+ return (!reachedMergeClose.empty());
+}
+
+MergeHandler::MergeHandler(Executor *_executor)
+ : executor(_executor), refCount(0) {
+}
+
+MergeHandler::~MergeHandler() {
+ releaseStates();
+}
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/lib/Core/Searcher.cpp new/klee-1.4.0+20180108/lib/Core/Searcher.cpp
--- old/klee-1.4.0+20171026/lib/Core/Searcher.cpp 2017-10-26 16:50:55.000000000 +0200
+++ new/klee-1.4.0+20180108/lib/Core/Searcher.cpp 2018-01-08 12:09:12.000000000 +0100
@@ -42,11 +42,6 @@
using namespace klee;
using namespace llvm;
-namespace {
- cl::opt<bool>
- DebugLogMerge("debug-log-merge");
-}
-
namespace klee {
extern RNG theRNG;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/lib/Core/SpecialFunctionHandler.cpp new/klee-1.4.0+20180108/lib/Core/SpecialFunctionHandler.cpp
--- old/klee-1.4.0+20171026/lib/Core/SpecialFunctionHandler.cpp 2017-10-26 16:50:55.000000000 +0200
+++ new/klee-1.4.0+20180108/lib/Core/SpecialFunctionHandler.cpp 2018-01-08 12:09:12.000000000 +0100
@@ -10,6 +10,7 @@
#include "Memory.h"
#include "SpecialFunctionHandler.h"
#include "TimingSolver.h"
+#include "klee/MergeHandler.h"
#include "klee/ExecutionState.h"
@@ -28,6 +29,7 @@
#include "llvm/IR/DataLayout.h"
#include
+#include <sstream>
using namespace llvm;
using namespace klee;
@@ -92,6 +94,8 @@
add("klee_is_symbolic", handleIsSymbolic, true),
add("klee_make_symbolic", handleMakeSymbolic, false),
add("klee_mark_global", handleMarkGlobal, false),
+ add("klee_open_merge", handleOpenMerge, false),
+ add("klee_close_merge", handleCloseMerge, false),
add("klee_prefer_cex", handlePreferCex, false),
add("klee_posix_prefer_cex", handlePosixPreferCex, false),
add("klee_print_expr", handlePrintExpr, false),
@@ -324,6 +328,43 @@
readStringAtAddress(state, arguments[3]).c_str());
}
+void SpecialFunctionHandler::handleOpenMerge(ExecutionState &state,
+ KInstruction *target,
+ std::vector][ &arguments) {
+ if (!UseMerge) {
+ klee_warning_once(0, "klee_open_merge ignored, use '-use-merge'");
+ return;
+ }
+
+ state.openMergeStack.push_back(
+ ref<MergeHandler>(new MergeHandler(&executor)));
+
+ if (DebugLogMerge)
+ llvm::errs() << "open merge: " << &state << "\n";
+}
+
+void SpecialFunctionHandler::handleCloseMerge(ExecutionState &state,
+ KInstruction *target,
+ std::vector][ &arguments) {
+ if (!UseMerge) {
+ klee_warning_once(0, "klee_close_merge ignored, use '-use-merge'");
+ return;
+ }
+ Instruction *i = target->inst;
+
+ if (DebugLogMerge)
+ llvm::errs() << "close merge: " << &state << " at " << i << '\n';
+
+ if (state.openMergeStack.empty()) {
+ std::ostringstream warning;
+ warning << &state << " ran into a close at " << i << " without a preceding open\n";
+ klee_warning(warning.str().c_str());
+ } else {
+ state.openMergeStack.back()->addClosedState(&state, i);
+ state.openMergeStack.pop_back();
+ }
+}
+
void SpecialFunctionHandler::handleNew(ExecutionState &state,
KInstruction *target,
std::vector][ &arguments) {
@@ -665,15 +706,22 @@
std::vector][ &arguments) {
std::string name;
- // FIXME: For backwards compatibility, we should eventually enforce the
- // correct arguments.
- if (arguments.size() == 2) {
+ // FIXME: For backwards compatibility. We should eventually enforce the
+ // correct arguments and types.
+ switch (arguments.size()) {
+ case 2:
+ klee_warning("klee_make_symbolic: deprecated number of arguments (2 instead of 3)");
+ break;
+ case 3:
+ name = readStringAtAddress(state, arguments[2]);
+ break;
+ default:
+ executor.terminateStateOnError(state, "illegal number of arguments to klee_make_symbolic(void*, size_t, char*)", Executor::User);
+ return;
+ }
+ if (name.length() == 0) {
name = "unnamed";
- } else {
- // FIXME: Should be a user.err, not an assert.
- assert(arguments.size()==3 &&
- "invalid number of arguments to klee_make_symbolic");
- name = readStringAtAddress(state, arguments[2]);
+ klee_warning("klee_make_symbolic: renamed empty name to \"unnamed\"");
}
Executor::ExactResolutionList rl;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/lib/Core/SpecialFunctionHandler.h new/klee-1.4.0+20180108/lib/Core/SpecialFunctionHandler.h
--- old/klee-1.4.0+20171026/lib/Core/SpecialFunctionHandler.h 2017-10-26 16:50:55.000000000 +0200
+++ new/klee-1.4.0+20180108/lib/Core/SpecialFunctionHandler.h 2018-01-08 12:09:12.000000000 +0100
@@ -116,6 +116,8 @@
HANDLER(handleMakeSymbolic);
HANDLER(handleMalloc);
HANDLER(handleMarkGlobal);
+ HANDLER(handleOpenMerge);
+ HANDLER(handleCloseMerge);
HANDLER(handleNew);
HANDLER(handleNewArray);
HANDLER(handlePreferCex);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/lib/Core/UserSearcher.cpp new/klee-1.4.0+20180108/lib/Core/UserSearcher.cpp
--- old/klee-1.4.0+20171026/lib/Core/UserSearcher.cpp 2017-10-26 16:50:55.000000000 +0200
+++ new/klee-1.4.0+20180108/lib/Core/UserSearcher.cpp 2018-01-08 12:09:12.000000000 +0100
@@ -13,6 +13,8 @@
#include "Executor.h"
#include "klee/Internal/Support/ErrorHandling.h"
+#include "klee/CommandLine.h"
+
#include "llvm/Support/CommandLine.h"
using namespace llvm;
@@ -58,8 +60,13 @@
void klee::initializeSearchOptions() {
// default values
if (CoreSearch.empty()) {
- CoreSearch.push_back(Searcher::RandomPath);
- CoreSearch.push_back(Searcher::NURS_CovNew);
+ if (UseMerge){
+ CoreSearch.push_back(Searcher::NURS_CovNew);
+ klee_warning("--use-merge enabled. Using NURS_CovNew as default searcher.");
+ } else {
+ CoreSearch.push_back(Searcher::RandomPath);
+ CoreSearch.push_back(Searcher::NURS_CovNew);
+ }
}
}
@@ -104,6 +111,12 @@
searcher = new InterleavedSearcher(s);
}
+ if (UseMerge) {
+ if (std::find(CoreSearch.begin(), CoreSearch.end(), Searcher::RandomPath) != CoreSearch.end()){
+ klee_error("use-merge currently does not support random-path, please use another search strategy");
+ }
+ }
+
if (UseBatchingSearch) {
searcher = new BatchingSearcher(searcher, BatchTime, BatchInstructions);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/test/CMakeLists.txt new/klee-1.4.0+20180108/test/CMakeLists.txt
--- old/klee-1.4.0+20171026/test/CMakeLists.txt 2017-10-26 16:50:55.000000000 +0200
+++ new/klee-1.4.0+20180108/test/CMakeLists.txt 2018-01-08 12:09:12.000000000 +0100
@@ -7,6 +7,7 @@
#
#===------------------------------------------------------------------------===#
+set(LIT_AUTOGENERATED_WARNING "This file is autogenerated, do not edit!")
set(KLEE_TOOLS_DIR "${CMAKE_BINARY_DIR}/bin")
set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}")
# FIXME: Do this to avoid changing the template file that
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/test/Feature/MakeSymbolicAPI.c new/klee-1.4.0+20180108/test/Feature/MakeSymbolicAPI.c
--- old/klee-1.4.0+20171026/test/Feature/MakeSymbolicAPI.c 1970-01-01 01:00:00.000000000 +0100
+++ new/klee-1.4.0+20180108/test/Feature/MakeSymbolicAPI.c 2018-01-08 12:09:12.000000000 +0100
@@ -0,0 +1,19 @@
+// RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc 2> %t.stderr.log
+// RUN: FileCheck %s -check-prefix=CHECK-WRN --input-file=%t.klee-out/warnings.txt
+// RUN: FileCheck %s -check-prefix=CHECK-ERR --input-file=%t.stderr.log
+
+int main() {
+ unsigned a, b, c;
+
+ klee_make_symbolic(&a, sizeof(a), "");
+// CHECK-WRN: KLEE: WARNING: klee_make_symbolic: renamed empty name to "unnamed"
+
+ klee_make_symbolic(&b, sizeof(b));
+// CHECK-WRN: KLEE: WARNING: klee_make_symbolic: deprecated number of arguments (2 instead of 3)
+// CHECK-WRN: KLEE: WARNING: klee_make_symbolic: renamed empty name to "unnamed"
+
+ klee_make_symbolic(&c);
+// CHECK-ERR: KLEE: ERROR: {{.*}} illegal number of arguments to klee_make_symbolic(void*, size_t, char*)
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/test/Merging/batching_break.c new/klee-1.4.0+20180108/test/Merging/batching_break.c
--- old/klee-1.4.0+20171026/test/Merging/batching_break.c 1970-01-01 01:00:00.000000000 +0100
+++ new/klee-1.4.0+20180108/test/Merging/batching_break.c 2018-01-08 12:09:12.000000000 +0100
@@ -0,0 +1,42 @@
+// RUN: %llvmgcc -emit-llvm -g -c -o %t.bc %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=nurs:covnew %t.bc 2>&1 | FileCheck %s
+
+// CHECK: open merge:
+// CHECK: close merge:
+// CHECK: KLEE: done: generated tests = 3{{$}}
+
+#include
+
+int main(int argc, char** args){
+
+ int x;
+ int p;
+ int i;
+
+ klee_make_symbolic(&x, sizeof(x), "x");
+ x = x % 20;
+
+ klee_open_merge();
+ for (i = 0; i < x; ++i){
+ if (x % 3 == 0){
+ klee_close_merge();
+ if (x > 10){
+ return 1;
+ } else {
+ return 2;
+ }
+ }
+ }
+ klee_close_merge();
+
+ klee_open_merge();
+ if (x > 10){
+ p = 1;
+ } else {
+ p = 2;
+ }
+ klee_close_merge();
+ return p;
+
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/test/Merging/easy_merge.c new/klee-1.4.0+20180108/test/Merging/easy_merge.c
--- old/klee-1.4.0+20171026/test/Merging/easy_merge.c 1970-01-01 01:00:00.000000000 +0100
+++ new/klee-1.4.0+20180108/test/Merging/easy_merge.c 2018-01-08 12:09:12.000000000 +0100
@@ -0,0 +1,44 @@
+// RUN: %llvmgcc -emit-llvm -g -c -o %t.bc %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=nurs:covnew --use-batching-search %t.bc 2>&1 | FileCheck %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=bfs --use-batching-search %t.bc 2>&1 | FileCheck %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=dfs --use-batching-search %t.bc 2>&1 | FileCheck %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=nurs:covnew %t.bc 2>&1 | FileCheck %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge %t.bc 2>&1 | FileCheck %s
+
+// CHECK: open merge:
+// CHECK: close merge:
+// CHECK: close merge:
+// CHECK: close merge:
+// CHECK: generated tests = 2{{$}}
+#include
+
+int main(int argc, char** args){
+
+ int x;
+ int a;
+ int foo = 0;
+
+ klee_make_symbolic(&x, sizeof(x), "x");
+ klee_make_symbolic(&a, sizeof(a), "a");
+
+ if (a == 0){
+ klee_open_merge();
+
+ if (x == 1) {
+ foo = 5;
+ } else if (x == 2) {
+ foo = 6;
+ } else {
+ foo = 7;
+ }
+
+ klee_close_merge();
+ }
+
+ return foo;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/test/Merging/indirect_value.c new/klee-1.4.0+20180108/test/Merging/indirect_value.c
--- old/klee-1.4.0+20171026/test/Merging/indirect_value.c 1970-01-01 01:00:00.000000000 +0100
+++ new/klee-1.4.0+20180108/test/Merging/indirect_value.c 2018-01-08 12:09:12.000000000 +0100
@@ -0,0 +1,32 @@
+// RUN: %llvmgcc -emit-llvm -g -c -o %t.bc %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=nurs:covnew --use-batching-search %t.bc 2>&1 | FileCheck %s
+
+// CHECK: generated tests = 2{{$}}
+#include
+#include
+
+#include
+
+int main(int argc, char** argv) {
+
+ int sym = klee_int("sym");
+ int* heap_int = calloc(1, sizeof(*heap_int));
+
+ klee_open_merge();
+
+ if(sym != 0) {
+ *heap_int = 1;
+ }
+
+ klee_close_merge();
+
+ klee_print_expr("*heap_int: ", *heap_int);
+ if(*heap_int != 0) {
+ printf("true\n");
+ } else {
+ printf("false\n");
+ }
+
+ return 0;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/test/Merging/loop_merge.c new/klee-1.4.0+20180108/test/Merging/loop_merge.c
--- old/klee-1.4.0+20171026/test/Merging/loop_merge.c 1970-01-01 01:00:00.000000000 +0100
+++ new/klee-1.4.0+20180108/test/Merging/loop_merge.c 2018-01-08 12:09:12.000000000 +0100
@@ -0,0 +1,38 @@
+// RUN: %llvmgcc -emit-llvm -g -c -o %t.bc %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=bfs %t.bc 2>&1 | FileCheck %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=dfs %t.bc 2>&1 | FileCheck %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=nurs:covnew %t.bc 2>&1 | FileCheck %s
+
+// CHECK: open merge:
+// There will be 20 'close merge' statements. Only checking a few, the generated
+// test count will confirm that the merge was closed correctly
+// CHECK: close merge:
+// CHECK: close merge:
+// CHECK: close merge:
+// CHECK: close merge:
+// CHECK: generated tests = 2{{$}}
+
+#include
+
+int main(int argc, char** args){
+
+ int x;
+ int i;
+
+ klee_make_symbolic(&x, sizeof(x), "x");
+ x = x % 20;
+
+ klee_open_merge();
+ for (i = 0; i < x; ++i){
+ if (x % 3 == 0){
+ klee_close_merge();
+ return 1;
+ }
+ }
+ klee_close_merge();
+
+ return 0;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/test/Merging/merge_fail.c new/klee-1.4.0+20180108/test/Merging/merge_fail.c
--- old/klee-1.4.0+20171026/test/Merging/merge_fail.c 1970-01-01 01:00:00.000000000 +0100
+++ new/klee-1.4.0+20180108/test/Merging/merge_fail.c 2018-01-08 12:09:12.000000000 +0100
@@ -0,0 +1,36 @@
+// RUN: %llvmgcc -emit-llvm -g -c -o %t.bc %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=bfs %t.bc 2>&1 | FileCheck %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=dfs %t.bc 2>&1 | FileCheck %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=nurs:covnew %t.bc 2>&1 | FileCheck %s
+
+// CHECK: open merge:
+// CHECK: generated tests = 2{{$}}
+
+// This test will not merge because we cannot merge states when they allocated memory.
+
+#include
+
+int main(int argc, char **args) {
+
+ int* arr = 0;
+ int a = 0;
+
+ klee_make_symbolic(&a, sizeof(a), "a");
+
+ klee_open_merge();
+ if (a == 0) {
+ arr = (int*) malloc(7 * sizeof(int));
+ arr[0] = 7;
+ } else {
+ arr = (int*) malloc(8 * sizeof(int));
+ arr[0] = 8;
+ }
+ klee_close_merge();
+ a = arr[0];
+ free(arr);
+
+ return a;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/test/Merging/nested_merge.c new/klee-1.4.0+20180108/test/Merging/nested_merge.c
--- old/klee-1.4.0+20171026/test/Merging/nested_merge.c 1970-01-01 01:00:00.000000000 +0100
+++ new/klee-1.4.0+20180108/test/Merging/nested_merge.c 2018-01-08 12:09:12.000000000 +0100
@@ -0,0 +1,48 @@
+// RUN: %llvmgcc -emit-llvm -g -c -o %t.bc %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=nurs:covnew --use-batching-search %t.bc 2>&1 | FileCheck %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=bfs --use-batching-search %t.bc 2>&1 | FileCheck %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=dfs --use-batching-search %t.bc 2>&1 | FileCheck %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=nurs:covnew %t.bc 2>&1 | FileCheck %s
+
+// CHECK: open merge:
+// 5 close merges
+// CHECK: close merge:
+// CHECK: close merge:
+// CHECK: close merge:
+// CHECK: close merge:
+// CHECK: close merge:
+// CHECK: generated tests = 1{{$}}
+
+#include
+
+int main(int argc, char **args) {
+
+ int x;
+ int a;
+ int foo = 0;
+
+ klee_make_symbolic(&x, sizeof(x), "x");
+ klee_make_symbolic(&a, sizeof(a), "a");
+
+ klee_open_merge();
+ if (a == 0) {
+ klee_open_merge();
+
+ if (x == 1) {
+ foo = 5;
+ } else if (x == 2) {
+ foo = 6;
+ } else {
+ foo = 7;
+ }
+
+ klee_close_merge();
+ }
+ klee_close_merge();
+
+ return foo;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/test/Merging/split_merge.c new/klee-1.4.0+20180108/test/Merging/split_merge.c
--- old/klee-1.4.0+20171026/test/Merging/split_merge.c 1970-01-01 01:00:00.000000000 +0100
+++ new/klee-1.4.0+20180108/test/Merging/split_merge.c 2018-01-08 12:09:12.000000000 +0100
@@ -0,0 +1,41 @@
+// RUN: %llvmgcc -emit-llvm -g -c -o %t.bc %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=nurs:covnew --use-batching-search %t.bc 2>&1 | FileCheck %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=bfs --use-batching-search %t.bc 2>&1 | FileCheck %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=dfs --use-batching-search %t.bc 2>&1 | FileCheck %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --debug-log-merge --search=nurs:covnew %t.bc 2>&1 | FileCheck %s
+
+
+// CHECK: open merge:
+// CHECK: close merge:
+// CHECK: close merge:
+// CHECK: close merge:
+// CHECK: generated tests = 2{{$}}
+
+#include
+
+int main(int argc, char** args){
+
+ int x;
+ int foo = 0;
+
+ klee_make_symbolic(&x, sizeof(x), "x");
+
+ klee_open_merge();
+
+ if (x == 1){
+ foo = 5;
+ } else if (x == 2){
+ klee_close_merge();
+ return 6;
+ } else {
+ foo = 7;
+ }
+
+ klee_close_merge();
+
+ return foo;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/test/Merging/unexpected_close.c new/klee-1.4.0+20180108/test/Merging/unexpected_close.c
--- old/klee-1.4.0+20171026/test/Merging/unexpected_close.c 1970-01-01 01:00:00.000000000 +0100
+++ new/klee-1.4.0+20180108/test/Merging/unexpected_close.c 2018-01-08 12:09:12.000000000 +0100
@@ -0,0 +1,35 @@
+// RUN: %llvmgcc -emit-llvm -g -c -o %t.bc %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --search=nurs:covnew --max-time=2 %t.bc
+
+// CHECK: ran into a close at
+// CHECK: generated tests = 2{{$}}
+
+#include
+
+int main(int argc, char **args) {
+
+ int x;
+ int a;
+ int foo = 0;
+
+ klee_make_symbolic(&x, sizeof(x), "x");
+ klee_make_symbolic(&a, sizeof(a), "a");
+
+ if (a == 0) {
+ klee_open_merge();
+
+ if (x == 1) {
+ foo = 5;
+ } else if (x == 2) {
+ foo = 6;
+ } else {
+ foo = 7;
+ }
+
+ klee_close_merge();
+ }
+ klee_close_merge();
+
+ return foo;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/test/lit.site.cfg.in new/klee-1.4.0+20180108/test/lit.site.cfg.in
--- old/klee-1.4.0+20171026/test/lit.site.cfg.in 2017-10-26 16:50:55.000000000 +0200
+++ new/klee-1.4.0+20180108/test/lit.site.cfg.in 2018-01-08 12:09:12.000000000 +0100
@@ -1,5 +1,9 @@
-## Autogenerated by LLVM/Clang configuration.
-# Do not edit!
+################################################################################
+#
+# @LIT_AUTOGENERATED_WARNING@
+#
+################################################################################
+
config.klee_src_root = "@KLEE_SOURCE_DIR@"
config.klee_obj_root = "@KLEE_BINARY_DIR@"
config.klee_tools_dir = "@KLEE_TOOLS_DIR@"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/test/regression/2016-11-24-bitcast-weak-alias.c new/klee-1.4.0+20180108/test/regression/2016-11-24-bitcast-weak-alias.c
--- old/klee-1.4.0+20171026/test/regression/2016-11-24-bitcast-weak-alias.c 2017-10-26 16:50:55.000000000 +0200
+++ new/klee-1.4.0+20180108/test/regression/2016-11-24-bitcast-weak-alias.c 2018-01-08 12:09:12.000000000 +0100
@@ -1,7 +1,7 @@
// REQUIRES: not-darwin
// RUN: %llvmgcc %s -Wall -emit-llvm -g -O0 -c -o %t.bc
// RUN: rm -rf %t.klee-out
-// RUN: klee --output-dir=%t.klee-out -exit-on-error -search=nurs:covnew %t.bc DUMMY_ARG >%t1.log 2>&1
+// RUN: %klee --output-dir=%t.klee-out -exit-on-error -search=nurs:covnew %t.bc DUMMY_ARG >%t1.log 2>&1
// RUN: FileCheck -input-file=%t1.log %s
// This test case is designed to cover code in `klee::getDirectCallTarget(CallSite)`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/test/regression/2017-11-01-test-with-empty-varname.c new/klee-1.4.0+20180108/test/regression/2017-11-01-test-with-empty-varname.c
--- old/klee-1.4.0+20171026/test/regression/2017-11-01-test-with-empty-varname.c 1970-01-01 01:00:00.000000000 +0100
+++ new/klee-1.4.0+20180108/test/regression/2017-11-01-test-with-empty-varname.c 2018-01-08 12:09:12.000000000 +0100
@@ -0,0 +1,11 @@
+// RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc
+// RUN: FileCheck %s --input-file=%t.klee-out/warnings.txt
+
+int main() {
+ unsigned a;
+
+ klee_make_symbolic(&a, sizeof(a), "");
+// CHECK-NOT: KLEE: WARNING: unable to write output test case, losing it
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/klee-1.4.0+20171026/tools/klee/main.cpp new/klee-1.4.0+20180108/tools/klee/main.cpp
--- old/klee-1.4.0+20171026/tools/klee/main.cpp 2017-10-26 16:50:55.000000000 +0200
+++ new/klee-1.4.0+20180108/tools/klee/main.cpp 2018-01-08 12:09:12.000000000 +0100
@@ -718,6 +718,8 @@
"klee_is_symbolic",
"klee_make_symbolic",
"klee_mark_global",
+ "klee_open_merge",
+ "klee_close_merge",
"klee_prefer_cex",
"klee_posix_prefer_cex",
"klee_print_expr",
++++++ klee-skip-some-tests.patch ++++++
From: Jiri Slaby
Date: Thu, 15 Jun 2017 15:20:49 +0200
Subject: klee: skip some tests
Patch-mainline: no
Some of the tests trigger FAILURE occasionally. The reason is unknown
yet. So mark them as to require an unknown prerequisite to disable the
tests completely.
Signed-off-by: Jiri Slaby
---
test/Concrete/ConstantExpr.llvm37.ll | 1 +
1 file changed, 1 insertion(+)
--- a/test/Concrete/ConstantExpr.llvm37.ll
+++ b/test/Concrete/ConstantExpr.llvm37.ll
@@ -1,3 +1,4 @@
+; REQUIRES: bubak
; REQUIRES: geq-llvm-3.7
; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s]