[lld][WebAssembly] Fix use of uninitialized stack data with --wasm64 … · llvm/llvm-project@d2953ab (original) (raw)

Original file line number Diff line number Diff line change
@@ -587,8 +587,7 @@ void ElemSection::writeBody() {
587 587 initExpr.Inst.Value.Global = WasmSym::tableBase->getGlobalIndex();
588 588 } else {
589 589 bool is64 = config->is64.value_or(false);
590 - initExpr.Inst.Opcode = is64 ? WASM_OPCODE_I64_CONST : WASM_OPCODE_I32_CONST;
591 - initExpr.Inst.Value.Int32 = config->tableBase;
590 + initExpr = intConst(config->tableBase, is64);
592 591 }
593 592 writeInitExpr(os, initExpr);
594 593