ir: Prevent crash when slicing hardcoded pointer

Closes #4780
This commit is contained in:
LemonBoy
2020-03-23 10:00:46 +01:00
committed by Andrew Kelley
parent 13d04f9963
commit 0cd953d40e
2 changed files with 15 additions and 1 deletions

View File

@@ -12819,7 +12819,7 @@ static IrInstGen *ir_resolve_ptr_of_array_to_slice(IrAnalyze *ira, IrInst* sourc
result->value->type = wanted_type;
return result;
}
} else {
} else if (array_ptr_val->data.x_ptr.special != ConstPtrSpecialHardCodedAddr) {
ZigValue *pointee = const_ptr_pointee(ira, ira->codegen, array_ptr_val, source_instr->source_node);
if (pointee == nullptr)
return ira->codegen->invalid_inst_gen;