diff --git a/src/compiler/code-assembler.cc b/src/compiler/code-assembler.cc index 4b1c211084..80abe34c69 100644 --- a/src/compiler/code-assembler.cc +++ b/src/compiler/code-assembler.cc @@ -1820,6 +1820,8 @@ void CodeAssemblerParameterizedLabelBase::AddInputs(std::vector inputs) { if (!phi_nodes_.empty()) { DCHECK_EQ(inputs.size(), phi_nodes_.size()); for (size_t i = 0; i < inputs.size(); ++i) { + // We use {nullptr} as a sentinel for an uninitialized value. + if (phi_nodes_[i] == nullptr) continue; state_->raw_assembler_->AppendPhiInput(phi_nodes_[i], inputs[i]); } } else { diff --git a/test/torque/test-torque.tq b/test/torque/test-torque.tq index 4c5011aa54..117f058e9c 100644 --- a/test/torque/test-torque.tq +++ b/test/torque/test-torque.tq @@ -413,6 +413,11 @@ namespace test { label Exit { check(j == 10); } + + // Test if we can handle uninitialized values on the stack. + let i: Smi; + for (let j: Smi = 0; j < 10; ++j) { + } } macro TestSubtyping(x: Smi) {