diff options
Diffstat (limited to 'src/tools/execution-results.h')
-rw-r--r-- | src/tools/execution-results.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/tools/execution-results.h b/src/tools/execution-results.h index c0c7428cc..7787dba25 100644 --- a/src/tools/execution-results.h +++ b/src/tools/execution-results.h @@ -69,11 +69,17 @@ struct ExecutionResults { auto* func = wasm.getFunction(exp->value); if (func->sig.results != Type::none) { // this has a result - results[exp->name] = run(func, wasm, instance); - // ignore the result if we hit an unreachable and returned no value - if (results[exp->name].type.isConcrete()) { - std::cout << "[fuzz-exec] note result: " << exp->name << " => " - << results[exp->name] << '\n'; + Literal ret = run(func, wasm, instance); + // We cannot compare funcrefs by name because function names can + // change (after duplicate function elimination or roundtripping) + // while the function contents are still the same + if (ret.type != Type::funcref) { + results[exp->name] = ret; + // ignore the result if we hit an unreachable and returned no value + if (results[exp->name].type.isConcrete()) { + std::cout << "[fuzz-exec] note result: " << exp->name << " => " + << results[exp->name] << '\n'; + } } } else { // no result, run it anyhow (it might modify memory etc.) @@ -100,17 +106,17 @@ struct ExecutionResults { auto name = iter.first; if (results.find(name) == results.end()) { std::cout << "[fuzz-exec] missing " << name << '\n'; - abort(); + return false; } std::cout << "[fuzz-exec] comparing " << name << '\n'; if (results[name] != other.results[name]) { std::cout << "not identical!\n"; - abort(); + return false; } } if (loggings != other.loggings) { std::cout << "logging not identical!\n"; - abort(); + return false; } return true; } @@ -138,7 +144,7 @@ struct ExecutionResults { // call the method for (Type param : func->sig.params.expand()) { // zeros in arguments TODO: more? - arguments.push_back(Literal(param)); + arguments.push_back(Literal::makeZero(param)); } return instance.callFunction(func->name, arguments); } catch (const TrapException&) { |