authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-12-22 17:09:11-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-12-22 17:09:11-05:00
logad92227516bf977a3be2802db525ac2d678acc7c
tree881ab1f3d00313266e6c78b9cc770b5950e19bf8
parent28dbdba37eed0cfd875cfc337446da3048743dd9
signature Commit is signed but in an unrecognized format.

report compile errors instead of crashing when frame is invalid


2 files changed, 4 insertions(+), 0 deletions(-)

src/analyze.cpp+2
...@@ -2003,6 +2003,8 @@ bool type_is_invalid(ZigType *type_entry) {...@@ -2003,6 +2003,8 @@ bool type_is_invalid(ZigType *type_entry) {
2003 return type_entry->data.unionation.resolve_status == ResolveStatusInvalid;2003 return type_entry->data.unionation.resolve_status == ResolveStatusInvalid;
2004 case ZigTypeIdEnum:2004 case ZigTypeIdEnum:
2005 return type_entry->data.enumeration.resolve_status == ResolveStatusInvalid;2005 return type_entry->data.enumeration.resolve_status == ResolveStatusInvalid;
2006 case ZigTypeIdFnFrame:
2007 return type_entry->data.frame.reported_loop_err;
2006 default:2008 default:
2007 return false;2009 return false;
2008 }2010 }
src/ir.cpp+2
...@@ -17061,6 +17061,8 @@ static Error ir_result_has_type(IrAnalyze *ira, ResultLoc *result_loc, bool *out...@@ -17061,6 +17061,8 @@ static Error ir_result_has_type(IrAnalyze *ira, ResultLoc *result_loc, bool *out
17061static IrInstruction *ir_resolve_no_result_loc(IrAnalyze *ira, IrInstruction *suspend_source_instr,17061static IrInstruction *ir_resolve_no_result_loc(IrAnalyze *ira, IrInstruction *suspend_source_instr,
17062 ResultLoc *result_loc, ZigType *value_type, bool force_runtime, bool non_null_comptime)17062 ResultLoc *result_loc, ZigType *value_type, bool force_runtime, bool non_null_comptime)
17063{17063{
17064 if (type_is_invalid(value_type))
17065 return ira->codegen->invalid_instruction;
17064 IrInstructionAllocaGen *alloca_gen = ir_build_alloca_gen(ira, suspend_source_instr, 0, "");17066 IrInstructionAllocaGen *alloca_gen = ir_build_alloca_gen(ira, suspend_source_instr, 0, "");
17065 alloca_gen->base.value->type = get_pointer_to_type_extra(ira->codegen, value_type, false, false,17067 alloca_gen->base.value->type = get_pointer_to_type_extra(ira->codegen, value_type, false, false,
17066 PtrLenSingle, 0, 0, 0, false);17068 PtrLenSingle, 0, 0, 0, false);