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) {...@@ -338,7 +338,7 @@ TypeTableEntry *get_smallest_unsigned_int_type(CodeGen *g, uint64_t x) {
338TypeTableEntry *get_pointer_to_type_extra(CodeGen *g, TypeTableEntry *child_type, bool is_const,338TypeTableEntry *get_pointer_to_type_extra(CodeGen *g, TypeTableEntry *child_type, bool is_const,
339 bool is_volatile, uint32_t byte_alignment, uint32_t bit_offset, uint32_t unaligned_bit_count)339 bool is_volatile, uint32_t byte_alignment, uint32_t bit_offset, uint32_t unaligned_bit_count)
340{340{
341 assert(child_type->id != TypeTableEntryIdInvalid);341 assert(!type_is_invalid(child_type));
342342
343 TypeId type_id = {};343 TypeId type_id = {};
344 TypeTableEntry **parent_pointer = nullptr;344 TypeTableEntry **parent_pointer = nullptr;
src/ir.cpp+3
...@@ -7966,6 +7966,9 @@ static IrInstruction *ir_get_const_ptr(IrAnalyze *ira, IrInstruction *instructio...@@ -7966,6 +7966,9 @@ static IrInstruction *ir_get_const_ptr(IrAnalyze *ira, IrInstruction *instructio
7966 ConstExprValue *const_val = &const_instr->value;7966 ConstExprValue *const_val = &const_instr->value;
7967 const_val->type = pointee_type;7967 const_val->type = pointee_type;
7968 type_ensure_zero_bits_known(ira->codegen, type_entry);7968 type_ensure_zero_bits_known(ira->codegen, type_entry);
7969 if (type_is_invalid(type_entry)) {
7970 return ira->codegen->invalid_instruction;
7971 }
7969 const_val->data.x_type = get_pointer_to_type_extra(ira->codegen, type_entry,7972 const_val->data.x_type = get_pointer_to_type_extra(ira->codegen, type_entry,
7970 ptr_is_const, ptr_is_volatile, get_abi_alignment(ira->codegen, type_entry), 0, 0);7973 ptr_is_const, ptr_is_volatile, get_abi_alignment(ira->codegen, type_entry), 0, 0);
7971 return const_instr;7974 return const_instr;