| ... | @@ -16877,7 +16877,7 @@ fn zirIntToPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -16877,7 +16877,7 @@ fn zirIntToPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16877 | } | 16877 | } |
| 16878 | | 16878 | |
| 16879 | try sema.requireRuntimeBlock(block, src, operand_src); | 16879 | try sema.requireRuntimeBlock(block, src, operand_src); |
| 16880 | if (block.wantSafety()) { | 16880 | if (block.wantSafety() and try sema.typeHasRuntimeBits(block, sema.src, type_res.elemType2())) { |
| 16881 | if (!type_res.isAllowzeroPtr()) { | 16881 | if (!type_res.isAllowzeroPtr()) { |
| 16882 | const is_non_zero = try block.addBinOp(.cmp_neq, operand_coerced, .zero_usize); | 16882 | const is_non_zero = try block.addBinOp(.cmp_neq, operand_coerced, .zero_usize); |
| 16883 | try sema.addSafetyCheck(block, is_non_zero, .cast_to_null); | 16883 | try sema.addSafetyCheck(block, is_non_zero, .cast_to_null); |
| ... | @@ -17169,7 +17169,9 @@ fn zirAlignCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -17169,7 +17169,9 @@ fn zirAlignCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 17169 | } | 17169 | } |
| 17170 | | 17170 | |
| 17171 | try sema.requireRuntimeBlock(block, inst_data.src(), ptr_src); | 17171 | try sema.requireRuntimeBlock(block, inst_data.src(), ptr_src); |
| 17172 | if (block.wantSafety() and dest_align > 1) { | 17172 | if (block.wantSafety() and dest_align > 1 and |
| | 17173 | try sema.typeHasRuntimeBits(block, sema.src, dest_ty.elemType2())) |
| | 17174 | { |
| 17173 | const val_payload = try sema.arena.create(Value.Payload.U64); | 17175 | const val_payload = try sema.arena.create(Value.Payload.U64); |
| 17174 | val_payload.* = .{ | 17176 | val_payload.* = .{ |
| 17175 | .base = .{ .tag = .int_u64 }, | 17177 | .base = .{ .tag = .int_u64 }, |
| ... | @@ -24489,7 +24491,9 @@ fn coerceCompatiblePtrs( | ... | @@ -24489,7 +24491,9 @@ fn coerceCompatiblePtrs( |
| 24489 | try sema.requireRuntimeBlock(block, inst_src, null); | 24491 | try sema.requireRuntimeBlock(block, inst_src, null); |
| 24490 | const inst_ty = sema.typeOf(inst); | 24492 | const inst_ty = sema.typeOf(inst); |
| 24491 | const inst_allows_zero = (inst_ty.zigTypeTag() == .Pointer and inst_ty.ptrAllowsZero()) or true; | 24493 | const inst_allows_zero = (inst_ty.zigTypeTag() == .Pointer and inst_ty.ptrAllowsZero()) or true; |
| 24492 | if (block.wantSafety() and inst_allows_zero and !dest_ty.ptrAllowsZero()) { | 24494 | if (block.wantSafety() and inst_allows_zero and !dest_ty.ptrAllowsZero() and |
| | 24495 | try sema.typeHasRuntimeBits(block, sema.src, dest_ty.elemType2())) |
| | 24496 | { |
| 24493 | const actual_ptr = if (inst_ty.isSlice()) | 24497 | const actual_ptr = if (inst_ty.isSlice()) |
| 24494 | try sema.analyzeSlicePtr(block, inst_src, inst, inst_ty) | 24498 | try sema.analyzeSlicePtr(block, inst_src, inst, inst_ty) |
| 24495 | else | 24499 | else |