diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/fuzzing.h | 5 | ||||
-rw-r--r-- | src/wasm/wasm-type.cpp | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index 595652c94..8bfb119da 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -673,8 +673,9 @@ private: Index numVars = upToSquared(MAX_VARS); for (Index i = 0; i < numVars; i++) { auto type = getConcreteType(); - if (type.isRef() && !type.isNullable()) { - // We can't use a nullable type as a var, which is null-initialized. + if (!type.isDefaultable()) { + // We can't use a nondefaultable type as a var, as those must be + // initialized to some default value. continue; } funcContext->typeLocals[type].push_back(params.size() + diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp index 73ff47ee8..2c516ed98 100644 --- a/src/wasm/wasm-type.cpp +++ b/src/wasm/wasm-type.cpp @@ -587,6 +587,14 @@ bool Type::isDefaultable() const { // A variable can get a default value if its type is concrete (unreachable // and none have no values, hence no default), and if it's a reference, it // must be nullable. + if (isTuple()) { + for (auto t : *this) { + if (!t.isDefaultable()) { + return false; + } + } + return true; + } return isConcrete() && (!isRef() || isNullable()) && !isRtt(); } |