| ... | @@ -18076,8 +18076,8 @@ fn bitOffsetOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!u6 | ... | @@ -18076,8 +18076,8 @@ fn bitOffsetOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!u6 |
| 18076 | const target = sema.mod.getTarget(); | 18076 | const target = sema.mod.getTarget(); |
| 18077 | | 18077 | |
| 18078 | try sema.resolveTypeLayout(block, lhs_src, ty); | 18078 | try sema.resolveTypeLayout(block, lhs_src, ty); |
| 18079 | switch (ty.tag()) { | 18079 | switch (ty.zigTypeTag()) { |
| 18080 | .@"struct", .tuple, .anon_struct => {}, | 18080 | .Struct => {}, |
| 18081 | else => { | 18081 | else => { |
| 18082 | const msg = msg: { | 18082 | const msg = msg: { |
| 18083 | const msg = try sema.errMsg(block, lhs_src, "expected struct type, found '{}'", .{ty.fmt(sema.mod)}); | 18083 | const msg = try sema.errMsg(block, lhs_src, "expected struct type, found '{}'", .{ty.fmt(sema.mod)}); |
| ... | @@ -19617,28 +19617,19 @@ fn zirMemcpy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void | ... | @@ -19617,28 +19617,19 @@ fn zirMemcpy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void |
| 19617 | const dest_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 19617 | const dest_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 19618 | const src_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; | 19618 | const src_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; |
| 19619 | const len_src: LazySrcLoc = .{ .node_offset_builtin_call_arg2 = inst_data.src_node }; | 19619 | const len_src: LazySrcLoc = .{ .node_offset_builtin_call_arg2 = inst_data.src_node }; |
| 19620 | const dest_ptr = try sema.resolveInst(extra.dest); | 19620 | const uncasted_dest_ptr = try sema.resolveInst(extra.dest); |
| 19621 | const dest_ptr_ty = sema.typeOf(dest_ptr); | | |
| 19622 | | 19621 | |
| 19623 | try sema.checkPtrOperand(block, dest_src, dest_ptr_ty); | 19622 | // TODO AstGen's coerced_ty cannot handle volatile here |
| 19624 | if (dest_ptr_ty.isConstPtr()) { | 19623 | var dest_ptr_info = Type.initTag(.manyptr_u8).ptrInfo().data; |
| 19625 | return sema.fail(block, dest_src, "cannot store through const pointer '{}'", .{dest_ptr_ty.fmt(sema.mod)}); | 19624 | dest_ptr_info.@"volatile" = sema.typeOf(uncasted_dest_ptr).isVolatilePtr(); |
| 19626 | } | 19625 | const dest_ptr_ty = try Type.ptr(sema.arena, sema.mod, dest_ptr_info); |
| | 19626 | const dest_ptr = try sema.coerce(block, dest_ptr_ty, uncasted_dest_ptr, dest_src); |
| 19627 | | 19627 | |
| 19628 | const uncasted_src_ptr = try sema.resolveInst(extra.source); | 19628 | const uncasted_src_ptr = try sema.resolveInst(extra.source); |
| 19629 | const uncasted_src_ptr_ty = sema.typeOf(uncasted_src_ptr); | 19629 | var src_ptr_info = Type.initTag(.manyptr_const_u8).ptrInfo().data; |
| 19630 | try sema.checkPtrOperand(block, src_src, uncasted_src_ptr_ty); | 19630 | src_ptr_info.@"volatile" = sema.typeOf(uncasted_src_ptr).isVolatilePtr(); |
| 19631 | const src_ptr_info = uncasted_src_ptr_ty.ptrInfo().data; | 19631 | const src_ptr_ty = try Type.ptr(sema.arena, sema.mod, src_ptr_info); |
| 19632 | const wanted_src_ptr_ty = try Type.ptr(sema.arena, sema.mod, .{ | 19632 | const src_ptr = try sema.coerce(block, src_ptr_ty, uncasted_src_ptr, src_src); |
| 19633 | .pointee_type = dest_ptr_ty.elemType2(), | | |
| 19634 | .@"align" = src_ptr_info.@"align", | | |
| 19635 | .@"addrspace" = src_ptr_info.@"addrspace", | | |
| 19636 | .mutable = false, | | |
| 19637 | .@"allowzero" = src_ptr_info.@"allowzero", | | |
| 19638 | .@"volatile" = src_ptr_info.@"volatile", | | |
| 19639 | .size = .Many, | | |
| 19640 | }); | | |
| 19641 | const src_ptr = try sema.coerce(block, wanted_src_ptr_ty, uncasted_src_ptr, src_src); | | |
| 19642 | const len = try sema.coerce(block, Type.usize, try sema.resolveInst(extra.byte_count), len_src); | 19633 | const len = try sema.coerce(block, Type.usize, try sema.resolveInst(extra.byte_count), len_src); |
| 19643 | | 19634 | |
| 19644 | const runtime_src = if (try sema.resolveDefinedValue(block, dest_src, dest_ptr)) |dest_ptr_val| rs: { | 19635 | const runtime_src = if (try sema.resolveDefinedValue(block, dest_src, dest_ptr)) |dest_ptr_val| rs: { |
| ... | @@ -19674,14 +19665,15 @@ fn zirMemset(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void | ... | @@ -19674,14 +19665,15 @@ fn zirMemset(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void |
| 19674 | const dest_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 19665 | const dest_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 19675 | const value_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; | 19666 | const value_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; |
| 19676 | const len_src: LazySrcLoc = .{ .node_offset_builtin_call_arg2 = inst_data.src_node }; | 19667 | const len_src: LazySrcLoc = .{ .node_offset_builtin_call_arg2 = inst_data.src_node }; |
| 19677 | const dest_ptr = try sema.resolveInst(extra.dest); | 19668 | const uncasted_dest_ptr = try sema.resolveInst(extra.dest); |
| 19678 | const dest_ptr_ty = sema.typeOf(dest_ptr); | 19669 | |
| 19679 | try sema.checkPtrOperand(block, dest_src, dest_ptr_ty); | 19670 | // TODO AstGen's coerced_ty cannot handle volatile here |
| 19680 | if (dest_ptr_ty.isConstPtr()) { | 19671 | var ptr_info = Type.initTag(.manyptr_u8).ptrInfo().data; |
| 19681 | return sema.fail(block, dest_src, "cannot store through const pointer '{}'", .{dest_ptr_ty.fmt(sema.mod)}); | 19672 | ptr_info.@"volatile" = sema.typeOf(uncasted_dest_ptr).isVolatilePtr(); |
| 19682 | } | 19673 | const dest_ptr_ty = try Type.ptr(sema.arena, sema.mod, ptr_info); |
| 19683 | const elem_ty = dest_ptr_ty.elemType2(); | 19674 | const dest_ptr = try sema.coerce(block, dest_ptr_ty, uncasted_dest_ptr, dest_src); |
| 19684 | const value = try sema.coerce(block, elem_ty, try sema.resolveInst(extra.byte), value_src); | 19675 | |
| | 19676 | const value = try sema.coerce(block, Type.u8, try sema.resolveInst(extra.byte), value_src); |
| 19685 | const len = try sema.coerce(block, Type.usize, try sema.resolveInst(extra.byte_count), len_src); | 19677 | const len = try sema.coerce(block, Type.usize, try sema.resolveInst(extra.byte_count), len_src); |
| 19686 | | 19678 | |
| 19687 | const runtime_src = if (try sema.resolveDefinedValue(block, dest_src, dest_ptr)) |ptr_val| rs: { | 19679 | const runtime_src = if (try sema.resolveDefinedValue(block, dest_src, dest_ptr)) |ptr_val| rs: { |