fix infinite loop when error in peer resolution

master
Andrew Kelley 2019-06-25 16:04:01 -04:00
parent cb55803a59
commit da68aec339
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
1 changed files with 21 additions and 8 deletions

View File

@ -16822,6 +16822,11 @@ static IrInstruction *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPh
peer_parent->done_resuming = true;
return ira_resume(ira);
}
if (peer_parent != nullptr && !peer_parent->skipped && peer_parent->base.resolved_loc != nullptr &&
type_is_invalid(peer_parent->base.resolved_loc->value.type))
{
return ira->codegen->invalid_instruction;
}
ZigList<IrBasicBlock*> new_incoming_blocks = {0};
ZigList<IrInstruction*> new_incoming_values = {0};
@ -24789,7 +24794,15 @@ static IrInstruction *ir_analyze_instruction_end_expr(IrAnalyze *ira, IrInstruct
return result_loc;
if (!was_written) {
ir_analyze_store_ptr(ira, &instruction->base, result_loc, value);
IrInstruction *store_ptr = ir_analyze_store_ptr(ira, &instruction->base, result_loc, value);
if (type_is_invalid(store_ptr->value.type)) {
instruction->result_loc->resolved_loc = ira->codegen->invalid_instruction;
if (instruction->result_loc->id == ResultLocIdPeer) {
reinterpret_cast<ResultLocPeer *>(instruction->result_loc)->parent->base.resolved_loc =
ira->codegen->invalid_instruction;
}
return ira->codegen->invalid_instruction;
}
}
if (result_loc->value.data.x_ptr.mut == ConstPtrMutInfer) {