about summary refs log tree commit diff homepage
path: root/lib/Core/SpecialFunctionHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Core/SpecialFunctionHandler.cpp')
-rw-r--r--lib/Core/SpecialFunctionHandler.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Core/SpecialFunctionHandler.cpp b/lib/Core/SpecialFunctionHandler.cpp
index 784bb8f1..8484a8a7 100644
--- a/lib/Core/SpecialFunctionHandler.cpp
+++ b/lib/Core/SpecialFunctionHandler.cpp
@@ -849,9 +849,10 @@ void SpecialFunctionHandler::handleMarkPatch(ExecutionState &state,
          "invalid number of arguments to klee_mark_patch");
   assert(isa<ConstantExpr>(arguments[0]) &&
          "expect constant patch number argument to klee_mark_patch");
-  if (state.patchNo)
+  auto patchNo = cast<ConstantExpr>(arguments[0])->getLimitedValue();
+  if (state.patchNo && patchNo != state.patchNo)
     executor.terminateStateEarly(state, "ignore patch combination",
                                  StateTerminationType::SilentExit);
   else
-    state.patchNo = cast<ConstantExpr>(arguments[0])->getLimitedValue();
+    executor.metaEnvVars[state.patchNo = patchNo] = state.metaEnvVar;
 }