authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-11-24 22:04:24-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-11-24 22:04:24-05:00
logcd36baf530d0c312884f485ed619438c1de91ef1
treed4edc52c68f77f39fdd8adf545f61adfef2c39e0
parent40480c7cdc84697219e8b2434772709ad948ed4d

fix assertion failed when invalid type encountered


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

src/analyze.cpp+1-1
......@@ -338,7 +338,7 @@ TypeTableEntry *get_smallest_unsigned_int_type(CodeGen *g, uint64_t x) {
338338TypeTableEntry *get_pointer_to_type_extra(CodeGen *g, TypeTableEntry *child_type, bool is_const,
339339 bool is_volatile, uint32_t byte_alignment, uint32_t bit_offset, uint32_t unaligned_bit_count)
340340{
341 assert(child_type->id != TypeTableEntryIdInvalid);
341 assert(!type_is_invalid(child_type));
342342
343343 TypeId type_id = {};
344344 TypeTableEntry **parent_pointer = nullptr;
src/ir.cpp+3
......@@ -7966,6 +7966,9 @@ static IrInstruction *ir_get_const_ptr(IrAnalyze *ira, IrInstruction *instructio
79667966 ConstExprValue *const_val = &const_instr->value;
79677967 const_val->type = pointee_type;
79687968 type_ensure_zero_bits_known(ira->codegen, type_entry);
7969 if (type_is_invalid(type_entry)) {
7970 return ira->codegen->invalid_instruction;
7971 }
79697972 const_val->data.x_type = get_pointer_to_type_extra(ira->codegen, type_entry,
79707973 ptr_is_const, ptr_is_volatile, get_abi_alignment(ira->codegen, type_entry), 0, 0);
79717974 return const_instr;