mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Sema: fix invalid pure Air instruction with comptime-known operands
This commit is contained in:
parent
e19886a898
commit
178ee8aef1
1 changed files with 3 additions and 3 deletions
|
|
@ -32508,11 +32508,11 @@ fn analyzeSlice(
|
||||||
const actual_len = if (array_ty.zigTypeTag(zcu) == .array)
|
const actual_len = if (array_ty.zigTypeTag(zcu) == .array)
|
||||||
try pt.intRef(.usize, array_ty.arrayLenIncludingSentinel(zcu))
|
try pt.intRef(.usize, array_ty.arrayLenIncludingSentinel(zcu))
|
||||||
else if (slice_ty.isSlice(zcu)) l: {
|
else if (slice_ty.isSlice(zcu)) l: {
|
||||||
const slice_len_inst = try block.addTyOp(.slice_len, .usize, ptr_or_slice);
|
const slice_len = try sema.analyzeSliceLen(block, src, ptr_or_slice);
|
||||||
break :l if (slice_ty.sentinel(zcu) == null)
|
break :l if (slice_ty.sentinel(zcu) == null)
|
||||||
slice_len_inst
|
slice_len
|
||||||
else
|
else
|
||||||
try sema.analyzeArithmetic(block, .add, slice_len_inst, .one, src, end_src, end_src, true);
|
try sema.analyzeArithmetic(block, .add, slice_len, .one, src, end_src, end_src, true);
|
||||||
} else break :bounds_check;
|
} else break :bounds_check;
|
||||||
|
|
||||||
const actual_end = if (slice_sentinel != null)
|
const actual_end = if (slice_sentinel != null)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue