From ca22c4dee94552f65e6044341b0365a21d794d65 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 14 Jul 2010 18:54:38 +0000 Subject: Add option to use an external version of STP This patch adds a new configure option, --with-stp, which configures KLEE to use an external version of STP instead of the version in the source tree. It includes documentation referring users to the STP download location. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@108347 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Solver/STPBuilder.h | 4 ++++ lib/Solver/Solver.cpp | 9 +++++++++ 2 files changed, 13 insertions(+) (limited to 'lib') diff --git a/lib/Solver/STPBuilder.h b/lib/Solver/STPBuilder.h index 30713253..4353857c 100644 --- a/lib/Solver/STPBuilder.h +++ b/lib/Solver/STPBuilder.h @@ -17,7 +17,11 @@ #include #define Expr VCExpr +#ifdef HAVE_EXT_STP +#include +#else #include "../../stp/c_interface/c_interface.h" +#endif #if ENABLE_STPLOG == 1 #include "stp/stplog.h" diff --git a/lib/Solver/Solver.cpp b/lib/Solver/Solver.cpp index 1d13a11d..4059a82b 100644 --- a/lib/Solver/Solver.cpp +++ b/lib/Solver/Solver.cpp @@ -453,6 +453,15 @@ STPSolverImpl::STPSolverImpl(STPSolver *_solver, bool _useForkedSTP, bool _optim assert(vc && "unable to create validity checker"); assert(builder && "unable to create STPBuilder"); +#ifdef HAVE_EXT_STP + // In newer versions of STP, a memory management mechanism has been + // introduced that automatically invalidates certain C interface + // pointers at vc_Destroy time. This caused double-free errors + // due to the ExprHandle destructor also attempting to invalidate + // the pointers using vc_DeleteExpr. By setting EXPRDELETE to 0 + // we restore the old behaviour. + vc_setInterfaceFlags(vc, EXPRDELETE, 0); +#endif vc_registerErrorHandler(::stp_error_handler); if (useForkedSTP) { -- cgit 1.4.1