| ... | ... | @@ -14812,6 +14812,7 @@ static bool type_can_bit_cast(ZigType *t) { |
| 14812 | 14812 | static IrInstruction *ir_resolve_result(IrAnalyze *ira, IrInstruction *suspend_source_instr, |
| 14813 | 14813 | ResultLoc *result_loc, ZigType *value_type, IrInstruction *value) |
| 14814 | 14814 | { |
| 14815 | Error err; |
| 14815 | 14816 | if (result_loc->resolved_loc != nullptr) { |
| 14816 | 14817 | // allow to redo the result location if the value is known and comptime and the previous one isn't |
| 14817 | 14818 | if (value == nullptr || !instr_is_comptime(value) || instr_is_comptime(result_loc->resolved_loc)) { |
| ... | ... | @@ -14962,7 +14963,18 @@ static IrInstruction *ir_resolve_result(IrAnalyze *ira, IrInstruction *suspend_s |
| 14962 | 14963 | { |
| 14963 | 14964 | return parent_result_loc; |
| 14964 | 14965 | } |
| 14965 | | ZigType *ptr_type = get_pointer_to_type(ira->codegen, value_type, false); |
| 14966 | ZigType *parent_ptr_type = parent_result_loc->value.type; |
| 14967 | assert(parent_ptr_type->id == ZigTypeIdPointer); |
| 14968 | if ((err = type_resolve(ira->codegen, parent_ptr_type->data.pointer.child_type, |
| 14969 | ResolveStatusAlignmentKnown))) |
| 14970 | { |
| 14971 | return ira->codegen->invalid_instruction; |
| 14972 | } |
| 14973 | uint64_t parent_ptr_align = get_ptr_align(ira->codegen, parent_ptr_type); |
| 14974 | ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, value_type, |
| 14975 | parent_ptr_type->data.pointer.is_const, parent_ptr_type->data.pointer.is_volatile, PtrLenSingle, |
| 14976 | parent_ptr_align, 0, 0, parent_ptr_type->data.pointer.allow_zero); |
| 14977 | |
| 14966 | 14978 | result_loc->written = true; |
| 14967 | 14979 | result_loc->resolved_loc = ir_analyze_ptr_cast(ira, suspend_source_instr, parent_result_loc, |
| 14968 | 14980 | ptr_type, result_bit_cast->base.source_instruction, false); |