Skip to content

Commit 435044d

Browse files
committed
Merge branch 'release-1.7.1'
2 parents 46ccd17 + 860fdce commit 435044d

32 files changed

+823
-432
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ add_library(smackTranslator STATIC
159159
include/smack/SmackRep.h
160160
include/smack/SmackRepFlatMem.h
161161
include/smack/MemorySafetyChecker.h
162+
include/smack/SignedIntegerOverflowChecker.h
162163
lib/smack/BoogieAst.cpp
163164
lib/smack/BplFilePrinter.cpp
164165
lib/smack/BplPrinter.cpp
@@ -175,6 +176,7 @@ add_library(smackTranslator STATIC
175176
lib/smack/SmackRep.cpp
176177
lib/smack/SmackRepFlatMem.cpp
177178
lib/smack/MemorySafetyChecker.cpp
179+
lib/smack/SignedIntegerOverflowChecker.cpp
178180
)
179181

180182
add_executable(llvm2bpl

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#---------------------------------------------------------------------------
66
DOXYFILE_ENCODING = UTF-8
77
PROJECT_NAME = smack
8-
PROJECT_NUMBER = 1.7.0
8+
PROJECT_NUMBER = 1.7.1
99
PROJECT_BRIEF = "A bounded software verifier."
1010
PROJECT_LOGO =
1111
OUTPUT_DIRECTORY = docs

bin/build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ INSTALL_DEPENDENCIES=1
2424
BUILD_Z3=1
2525
BUILD_BOOGIE=1
2626
BUILD_CORRAL=1
27-
BUILD_LOCKPWN=0
27+
BUILD_LOCKPWN=1
2828
BUILD_SMACK=1
2929
TEST_SMACK=1
3030
BUILD_LLVM=0 # LLVM is typically installed from packages (see below)
@@ -369,6 +369,7 @@ then
369369
cd ${ROOT}
370370
git clone https://github.com/smackers/lockpwn.git
371371
cd ${LOCKPWN_DIR}
372+
git reset --hard ${LOCKPWN_COMMIT}
372373
xbuild lockpwn.sln /p:Configuration=Release
373374
ln -s ${Z3_DIR}/bin/z3 ${LOCKPWN_DIR}/Binaries/z3.exe
374375

bin/package-smack.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Note: this script requires CDE to be downloaded from
77
# http://www.pgbovine.net/cde.html
88

9-
VERSION=1.7.0
9+
VERSION=1.7.1
1010
PACKAGE=smack-$VERSION-64
1111

1212
# Create folder to export

bin/smack-svcomp-wrapper.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@
44

55
ROOT="$( cd "$(dirname "$(readlink -f "${0}")")" && pwd )"
66
SMACK_BIN="${ROOT}/smack/bin"
7+
BOOGIE_BIN="${ROOT}/boogie"
78
CORRAL_BIN="${ROOT}/corral"
89
LOCKPWN_BIN="${ROOT}/lockpwn"
910
LLVM_BIN="${ROOT}/llvm/bin"
11+
LLVM_LIB="${ROOT}/llvm/lib"
1012

11-
# Setting mono heap size to 9GB
12-
export MONO_GC_PARAMS=max-heap-size=9g
13+
# Setting mono heap size to 13GB
14+
export MONO_GC_PARAMS=max-heap-size=13g
1315

1416
export PATH=${LLVM_BIN}:$SMACK_BIN:$PATH
17+
export BOOGIE="mono ${BOOGIE_BIN}/Boogie.exe"
1518
export CORRAL="mono ${CORRAL_BIN}/corral.exe"
1619
export LOCKPWN="mono ${LOCKPWN_BIN}/lockpwn.exe"
20+
export LD_LIBRARY_PATH=${LLVM_LIB}:$LD_LIBRARY_PATH
1721

1822
smack -x=svcomp --verifier=svcomp -q $@
1923

bin/versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
MONO_VERSION=3.8.0
22
BOOGIE_COMMIT=4e4c3a5252
33
CORRAL_COMMIT=874a078e39
4+
LOCKPWN_COMMIT=a4d802a1cb

include/smack/BoogieAst.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ class Attr {
194194
public:
195195
Attr(std::string n, std::initializer_list<const Expr*> vs) : name(n), vals(vs) {}
196196
void print(std::ostream& os) const;
197+
std::string getName() const { return name; }
197198

198199
static const Attr* attr(std::string s);
199200
static const Attr* attr(std::string s, std::string v);
@@ -268,6 +269,13 @@ class AssumeStmt : public Stmt {
268269
void add(const Attr* a) {
269270
attrs.push_back(a);
270271
}
272+
bool hasAttr(std::string name) const {
273+
for (auto a = attrs.begin(); a != attrs.end(); ++a) {
274+
if ((*a)->getName() == name)
275+
return true;
276+
}
277+
return false;
278+
}
271279
void print(std::ostream& os) const;
272280
static bool classof(const Stmt* S) { return S->getKind() == ASSUME; }
273281
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//
2+
// This file is distributed under the MIT License. See LICENSE for details.
3+
//
4+
#ifndef SIGNEDINTEGEROVERFLOWCHECKER_H
5+
#define SIGNEDINTEGEROVERFLOWCHECKER_H
6+
7+
#include "llvm/Pass.h"
8+
#include "llvm/IR/Module.h"
9+
#include <map>
10+
11+
namespace smack {
12+
13+
class SignedIntegerOverflowChecker: public llvm::ModulePass {
14+
public:
15+
static char ID; // Pass identification, replacement for typeid
16+
SignedIntegerOverflowChecker() : llvm::ModulePass(ID) {}
17+
virtual bool runOnModule(llvm::Module& m);
18+
private:
19+
static std::map<std::string, llvm::Instruction::BinaryOps> INSTRUCTION_TABLE;
20+
static std::map<int, std::string> INT_MAX_TABLE;
21+
static std::map<int, std::string> INT_MIN_TABLE;
22+
void replaceValue(llvm::Value* ee, llvm::Value* er);
23+
};
24+
25+
}
26+
27+
#endif //SIGNEDINTEGEROVERFLOWCHECKER_H

include/smack/SmackInstGenerator.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class SmackInstGenerator : public llvm::InstVisitor<SmackInstGenerator> {
2323
Naming& naming;
2424

2525
Block* currBlock;
26+
llvm::BasicBlock::const_iterator nextInst;
2627
std::map<const llvm::BasicBlock*, Block*> blockMap;
2728
std::map<const llvm::Value*, std::string> sourceNames;
2829

include/smack/SmackRep.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class SmackRep {
6868

6969
const Expr* cast(unsigned opcode, const llvm::Value* v, const llvm::Type* t);
7070
const Expr* bop(unsigned opcode, const llvm::Value* lhs, const llvm::Value* rhs, const llvm::Type* t);
71-
const Expr* cmp(unsigned predicate, const llvm::Value* lhs, const llvm::Value* rhs);
71+
const Expr* cmp(unsigned predicate, const llvm::Value* lhs, const llvm::Value* rhs, bool isUnsigned);
7272

7373
std::string procName(const llvm::User& U);
7474
std::string procName(llvm::Function* F, const llvm::User& U);
@@ -99,14 +99,14 @@ class SmackRep {
9999
std::string type(const llvm::Type* t);
100100
std::string type(const llvm::Value* v);
101101

102-
const Expr* lit(const llvm::Value* v);
102+
const Expr* lit(const llvm::Value* v, bool isUnsigned=false);
103103
const Expr* lit(const llvm::Value* v, unsigned flag);
104104

105105
const Expr* ptrArith(const llvm::GetElementPtrInst* I);
106106
const Expr* ptrArith(const llvm::ConstantExpr* CE);
107107
const Expr* ptrArith(const llvm::Value* p, std::vector< std::pair<llvm::Value*,llvm::Type*> > args);
108108

109-
const Expr* expr(const llvm::Value* v);
109+
const Expr* expr(const llvm::Value* v, bool isConstIntUnsigned=false);
110110

111111
const Expr* cast(const llvm::Instruction* I);
112112
const Expr* cast(const llvm::ConstantExpr* CE);

0 commit comments

Comments
 (0)