diff options
Diffstat (limited to 'src/tools/fuzzing.h')
-rw-r--r-- | src/tools/fuzzing.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index a0d5430d8..595652c94 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -723,7 +723,9 @@ private: while (oneIn(3) && !finishedInput) { auto& randomElem = wasm.elementSegments[upTo(wasm.elementSegments.size())]; - randomElem->data.push_back(func->name); + // FIXME: make the type NonNullable when we support it! + auto type = Type(HeapType(func->sig), Nullable); + randomElem->data.push_back(builder.makeRefFunc(func->name, type)); } numAddedFunctions++; return func; @@ -1436,11 +1438,13 @@ private: bool isReturn; while (1) { // TODO: handle unreachable - targetFn = wasm.getFunction(data[i]); - isReturn = type == Type::unreachable && wasm.features.hasTailCall() && - funcContext->func->sig.results == targetFn->sig.results; - if (targetFn->sig.results == type || isReturn) { - break; + if (auto* get = data[i]->dynCast<RefFunc>()) { + targetFn = wasm.getFunction(get->func); + isReturn = type == Type::unreachable && wasm.features.hasTailCall() && + funcContext->func->sig.results == targetFn->sig.results; + if (targetFn->sig.results == type || isReturn) { + break; + } } i++; if (i == data.size()) { |