| ... | ... | @@ -16333,7 +16333,19 @@ static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspe |
| 16333 | 16333 | if (!type_has_bits(value_type)) { |
| 16334 | 16334 | parent_ptr_align = 0; |
| 16335 | 16335 | } |
| 16336 | | ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, value_type, |
| 16336 | // If we're casting from a sentinel-terminated array to a non-sentinel-terminated array, |
| 16337 | // we actually need the result location pointer to *not* have a sentinel. Otherwise the generated |
| 16338 | // memcpy will write an extra byte to the destination, and THAT'S NO GOOD. |
| 16339 | ZigType *ptr_elem_type; |
| 16340 | if (value_type->id == ZigTypeIdArray && value_type->data.array.sentinel != nullptr && |
| 16341 | dest_type->id == ZigTypeIdArray && dest_type->data.array.sentinel == nullptr) |
| 16342 | { |
| 16343 | ptr_elem_type = get_array_type(ira->codegen, value_type->data.array.child_type, |
| 16344 | value_type->data.array.len, nullptr); |
| 16345 | } else { |
| 16346 | ptr_elem_type = value_type; |
| 16347 | } |
| 16348 | ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, ptr_elem_type, |
| 16337 | 16349 | parent_ptr_type->data.pointer.is_const, parent_ptr_type->data.pointer.is_volatile, PtrLenSingle, |
| 16338 | 16350 | parent_ptr_align, 0, 0, parent_ptr_type->data.pointer.allow_zero); |
| 16339 | 16351 | |