authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-02-18 18:33:21-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-02-18 18:33:21-05:00
logc4ee37f5067e7dd2c017df1fd6c57c1fad92cf85
tree296bbdc9529662abe24ae39ac1800399a64b488b
parent0148f39df929cc00c1b2231acce41c22f74f9969

fix assertion failure when first use of a struct is sizeOf


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

src/analyze.cpp+1
......@@ -253,6 +253,7 @@ bool type_has_zero_bits_known(TypeTableEntry *type_entry) {
253253
254254
255255uint64_t type_size(CodeGen *g, TypeTableEntry *type_entry) {
256 assert(type_is_complete(type_entry));
256257 if (type_has_bits(type_entry)) {
257258 return LLVMStoreSizeOfType(g->target_data_ref, type_entry->type_ref);
258259 } else {
src/ir.cpp+3
......@@ -9904,6 +9904,9 @@ static TypeTableEntry *ir_analyze_instruction_size_of(IrAnalyze *ira,
99049904 IrInstruction *type_value = size_of_instruction->type_value->other;
99059905 TypeTableEntry *type_entry = ir_resolve_type(ira, type_value);
99069906 TypeTableEntry *canon_type_entry = get_underlying_type(type_entry);
9907
9908 ensure_complete_type(ira->codegen, type_entry);
9909
99079910 switch (canon_type_entry->id) {
99089911 case TypeTableEntryIdInvalid:
99099912 return ira->codegen->builtin_types.entry_invalid;