| ... | @@ -15441,8 +15441,17 @@ fn zirReify(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I | ... | @@ -15441,8 +15441,17 @@ fn zirReify(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I |
| 15441 | const is_allowzero_val = struct_val[6]; | 15441 | const is_allowzero_val = struct_val[6]; |
| 15442 | const sentinel_val = struct_val[7]; | 15442 | const sentinel_val = struct_val[7]; |
| 15443 | | 15443 | |
| | 15444 | const abi_align = @intCast(u29, alignment_val.toUnsignedInt(target)); // TODO: Validate this value. |
| | 15445 | |
| 15444 | var buffer: Value.ToTypeBuffer = undefined; | 15446 | var buffer: Value.ToTypeBuffer = undefined; |
| 15445 | const child_ty = child_val.toType(&buffer); | 15447 | const unresolved_elem_ty = child_val.toType(&buffer); |
| | 15448 | const elem_ty = if (abi_align == 0) |
| | 15449 | unresolved_elem_ty |
| | 15450 | else t: { |
| | 15451 | const elem_ty = try sema.resolveTypeFields(block, src, unresolved_elem_ty); |
| | 15452 | try sema.resolveTypeLayout(block, src, elem_ty); |
| | 15453 | break :t elem_ty; |
| | 15454 | }; |
| 15446 | | 15455 | |
| 15447 | const ptr_size = size_val.toEnum(std.builtin.Type.Pointer.Size); | 15456 | const ptr_size = size_val.toEnum(std.builtin.Type.Pointer.Size); |
| 15448 | | 15457 | |
| ... | @@ -15454,7 +15463,7 @@ fn zirReify(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I | ... | @@ -15454,7 +15463,7 @@ fn zirReify(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I |
| 15454 | const sentinel_ptr_val = sentinel_val.castTag(.opt_payload).?.data; | 15463 | const sentinel_ptr_val = sentinel_val.castTag(.opt_payload).?.data; |
| 15455 | const ptr_ty = try Type.ptr(sema.arena, mod, .{ | 15464 | const ptr_ty = try Type.ptr(sema.arena, mod, .{ |
| 15456 | .@"addrspace" = .generic, | 15465 | .@"addrspace" = .generic, |
| 15457 | .pointee_type = child_ty, | 15466 | .pointee_type = try elem_ty.copy(sema.arena), |
| 15458 | }); | 15467 | }); |
| 15459 | actual_sentinel = (try sema.pointerDeref(block, src, sentinel_ptr_val, ptr_ty)).?; | 15468 | actual_sentinel = (try sema.pointerDeref(block, src, sentinel_ptr_val, ptr_ty)).?; |
| 15460 | } | 15469 | } |
| ... | @@ -15463,9 +15472,9 @@ fn zirReify(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I | ... | @@ -15463,9 +15472,9 @@ fn zirReify(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I |
| 15463 | .size = ptr_size, | 15472 | .size = ptr_size, |
| 15464 | .mutable = !is_const_val.toBool(), | 15473 | .mutable = !is_const_val.toBool(), |
| 15465 | .@"volatile" = is_volatile_val.toBool(), | 15474 | .@"volatile" = is_volatile_val.toBool(), |
| 15466 | .@"align" = @intCast(u29, alignment_val.toUnsignedInt(target)), // TODO: Validate this value. | 15475 | .@"align" = abi_align, |
| 15467 | .@"addrspace" = address_space_val.toEnum(std.builtin.AddressSpace), | 15476 | .@"addrspace" = address_space_val.toEnum(std.builtin.AddressSpace), |
| 15468 | .pointee_type = try child_ty.copy(sema.arena), | 15477 | .pointee_type = try elem_ty.copy(sema.arena), |
| 15469 | .@"allowzero" = is_allowzero_val.toBool(), | 15478 | .@"allowzero" = is_allowzero_val.toBool(), |
| 15470 | .sentinel = actual_sentinel, | 15479 | .sentinel = actual_sentinel, |
| 15471 | }); | 15480 | }); |