authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-03 18:25:00-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-03 18:25:00-04:00
log18620756520d198f581b9a9acbf25c8cbb79ad11
tree993389ab3f52fdb62cf48366cc3fcb92737284b5
parenta81e4351a20f836d88f455843d875e45a1c73b71
signaturelock-open Commit is signed but in an unrecognized format.

fix union field ptr ir instruction


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

src/ir.cpp+7-2
...@@ -17464,7 +17464,12 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_...@@ -17464,7 +17464,12 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_
17464 return ir_analyze_container_member_access_inner(ira, bare_type, field_name,17464 return ir_analyze_container_member_access_inner(ira, bare_type, field_name,
17465 source_instr, container_ptr, container_type);17465 source_instr, container_ptr, container_type);
17466 }17466 }
17467 ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, field->type_entry,17467
17468 ZigType *field_type = resolve_union_field_type(ira->codegen, field);
17469 if (field_type == nullptr)
17470 return ira->codegen->invalid_instruction;
17471
17472 ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, field_type,
17468 is_const, is_volatile, PtrLenSingle, 0, 0, 0, false);17473 is_const, is_volatile, PtrLenSingle, 0, 0, 0, false);
17469 if (instr_is_comptime(container_ptr)) {17474 if (instr_is_comptime(container_ptr)) {
17470 ConstExprValue *ptr_val = ir_resolve_const(ira, container_ptr, UndefBad);17475 ConstExprValue *ptr_val = ir_resolve_const(ira, container_ptr, UndefBad);
...@@ -17481,7 +17486,7 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_...@@ -17481,7 +17486,7 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_
17481 if (initializing) {17486 if (initializing) {
17482 ConstExprValue *payload_val = create_const_vals(1);17487 ConstExprValue *payload_val = create_const_vals(1);
17483 payload_val->special = ConstValSpecialUndef;17488 payload_val->special = ConstValSpecialUndef;
17484 payload_val->type = field->type_entry;17489 payload_val->type = field_type;
17485 payload_val->parent.id = ConstParentIdUnion;17490 payload_val->parent.id = ConstParentIdUnion;
17486 payload_val->parent.data.p_union.union_val = union_val;17491 payload_val->parent.data.p_union.union_val = union_val;
1748717492