diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-08-08 21:27:42 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-08-08 21:27:42 +0100 |
| commit | f4c04052212e0ee17aa1ae9c7d8ada0727f269b1 (patch) | |
| tree | 98af2378b256a24dc573d06dccbab073f927fcfa /src/ir.cpp | |
| parent | 49d337c83039715fd3100f6ec8a88dff80c08c4b (diff) | |
Fix inline #raw_union bug in issue #87
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 0918eba11..791514047 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -2523,16 +2523,13 @@ irValue *ir_emit_deep_field_gep(irProcedure *proc, irValue *e, Selection sel) { if (is_type_raw_union(type)) { type = type->Struct.fields[index]->type; e = ir_emit_conv(proc, e, make_type_pointer(a, type)); + } else if (is_type_struct(type)) { + type = type->Struct.fields[index]->type; + e = ir_emit_struct_ep(proc, e, index); } else if (type->kind == Type_Union) { GB_ASSERT(index == -1); type = t_type_info_ptr; e = ir_emit_struct_ep(proc, e, index); - } else if (type->kind == Type_Struct) { - type = type->Struct.fields[index]->type; - if (type->Struct.is_raw_union) { - } else { - e = ir_emit_struct_ep(proc, e, index); - } } else if (type->kind == Type_Tuple) { type = type->Tuple.variables[index]->type; e = ir_emit_struct_ep(proc, e, index); @@ -5159,6 +5156,7 @@ irAddr ir_build_addr(irProcedure *proc, AstNode *expr) { Selection sel = lookup_field(proc->module->allocator, type, selector, false); GB_ASSERT(sel.entity != nullptr); + if (sel.entity->type->kind == Type_BitFieldValue) { irAddr addr = ir_build_addr(proc, se->expr); Type *bft = type_deref(ir_addr_type(addr)); @@ -5180,6 +5178,7 @@ irAddr ir_build_addr(irProcedure *proc, AstNode *expr) { return ir_addr(a); } } else { + // NOTE(bill): x.0 Type *type = type_deref(type_of_expr(proc->module->info, se->expr)); Type *selector_type = base_type(type_of_expr(proc->module->info, se->selector)); GB_ASSERT_MSG(is_type_integer(selector_type), "%s", type_to_string(selector_type)); |