Skip to content

Commit 27c53c6

Browse files
committed
fix:
1 parent c81ee9f commit 27c53c6

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

lib/Core/Executor.cpp

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7368,8 +7368,8 @@ void Executor::setInitializationGraph(
73687368
return;
73697369
}
73707370

7371-
bool isReproducible(const klee::Symbolic &symb) {
7372-
auto arr = symb.array;
7371+
bool isReproducible(const klee::Array *array) {
7372+
auto arr = array;
73737373
bool bad = IrreproducibleSource::classof(arr->source.get());
73747374
if (auto liSource = dyn_cast<LazyInitializationSource>(arr->source.get())) {
73757375
std::vector<const Array *> arrays;
@@ -7385,6 +7385,10 @@ bool isReproducible(const klee::Symbolic &symb) {
73857385
return !bad;
73867386
}
73877387

7388+
bool isIrreproducible(const klee::Array *array) {
7389+
return !isReproducible(array);
7390+
}
7391+
73887392
bool isUninitialized(const klee::Array *array) {
73897393
bool bad = isa<UninitializedSource>(array->source);
73907394
if (bad)
@@ -7394,7 +7398,11 @@ bool isUninitialized(const klee::Array *array) {
73947398
return bad;
73957399
}
73967400

7397-
bool isMakeSymbolic(const klee::Symbolic &symb) {
7401+
bool isReproducibleSymbol(const klee::Symbolic &symb) {
7402+
return isReproducible(symb.array);
7403+
}
7404+
7405+
bool isMakeSymbolicSymbol(const klee::Symbolic &symb) {
73987406
auto array = symb.array;
73997407
bool good = isa<MakeSymbolicSource>(array->source);
74007408
if (!good)
@@ -7445,20 +7453,23 @@ bool Executor::getSymbolicSolution(const ExecutionState &state, KTest &res) {
74457453
std::vector<const Array *> uninitObjects;
74467454
std::copy_if(allObjects.begin(), allObjects.end(),
74477455
std::back_inserter(uninitObjects), isUninitialized);
7456+
std::vector<const Array *> irreproducibleObjects;
7457+
std::copy_if(allObjects.begin(), allObjects.end(),
7458+
std::back_inserter(irreproducibleObjects), isIrreproducible);
74487459

74497460
std::vector<klee::Symbolic> symbolics;
74507461

74517462
if (OnlyOutputMakeSymbolicArrays) {
74527463
std::copy_if(state.symbolics.begin(), state.symbolics.end(),
7453-
std::back_inserter(symbolics), isMakeSymbolic);
7464+
std::back_inserter(symbolics), isMakeSymbolicSymbol);
74547465
} else {
74557466
std::copy_if(state.symbolics.begin(), state.symbolics.end(),
7456-
std::back_inserter(symbolics), isReproducible);
7467+
std::back_inserter(symbolics), isReproducibleSymbol);
74577468
}
74587469

74597470
// we cannot be sure that an irreproducible state proves the presence of an
74607471
// error
7461-
if (uninitObjects.size() > 0 || state.symbolics.size() != symbolics.size()) {
7472+
if (uninitObjects.size() > 0 || irreproducibleObjects.size() > 0) {
74627473
state.error = ReachWithError::None;
74637474
} else if (FunctionCallReproduce != "" &&
74647475
state.error == ReachWithError::Reachable) {

lib/Core/MockBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ void MockBuilder::buildExternalGlobalsDefinitions() {
232232
global->setInitializer(zeroInitializer);
233233
global->setDSOLocal(true);
234234
auto *localPointer = builder->CreateAlloca(elementType, nullptr);
235-
buildCallKleeMakeSymbolic("klee_make_symbolic", localPointer, elementType,
235+
buildCallKleeMakeSymbolic("klee_make_mock", localPointer, elementType,
236236
"external_" + extName);
237237
llvm::Value *localValue = builder->CreateLoad(elementType, localPointer);
238238
builder->CreateStore(localValue, global);

0 commit comments

Comments
 (0)