| ... | @@ -6615,8 +6615,23 @@ fn moveConstant(isel: *Select, dst: Value.Location, init_constant: Constant, ini | ... | @@ -6615,8 +6615,23 @@ fn moveConstant(isel: *Select, dst: Value.Location, init_constant: Constant, ini |
| 6615 | .field => |field_idx| { | 6615 | .field => |field_idx| { |
| 6616 | var base_ptr = ip.indexToKey(field_idx.base).ptr; | 6616 | var base_ptr = ip.indexToKey(field_idx.base).ptr; |
| 6617 | const agg_ty: ZigType = .fromInterned(ip.indexToKey(base_ptr.ty).ptr_type.child); | 6617 | const agg_ty: ZigType = .fromInterned(ip.indexToKey(base_ptr.ty).ptr_type.child); |
| 6618 | base_ptr.byte_offset += agg_ty.structFieldOffset(@intCast(field_idx.index), zcu) + ptr.byte_offset; | 6618 | switch (ip.indexToKey(agg_ty.toIntern())) { |
| 6619 | continue :constant_key .{ .ptr = base_ptr }; | 6619 | .ptr_type => |ptr_ty| { |
| | 6620 | assert(ptr_ty.flags.size == .slice); |
| | 6621 | const field_offset = switch (field_idx.index) { |
| | 6622 | Constant.slice_ptr_index => 0, |
| | 6623 | Constant.slice_len_index => isel.gprSize(), |
| | 6624 | else => unreachable, |
| | 6625 | }; |
| | 6626 | base_ptr.byte_offset += ptr.byte_offset + field_offset; |
| | 6627 | continue :constant_key .{ .ptr = base_ptr }; |
| | 6628 | }, |
| | 6629 | .struct_type, .tuple_type, .union_type => { |
| | 6630 | base_ptr.byte_offset += agg_ty.structFieldOffset(@intCast(field_idx.index), zcu) + ptr.byte_offset; |
| | 6631 | continue :constant_key .{ .ptr = base_ptr }; |
| | 6632 | }, |
| | 6633 | else => unreachable, |
| | 6634 | } |
| 6620 | }, | 6635 | }, |
| 6621 | .comptime_alloc, .comptime_field, .arr_elem => unreachable, | 6636 | .comptime_alloc, .comptime_field, .arr_elem => unreachable, |
| 6622 | }; | 6637 | }; |