| author | |
| committer | |
| log | 40578656e85a4bd930b03c143f179d43a925d151 |
| tree | 521053cc75e0b05a1baee26f640e1fc6e87c8aa7 |
| parent | c0350cf87eaae64ca81e17aef8872e8e55767437 |
Closes #128903 files changed, 25 insertions(+), 1 deletions(-)
src/Zir.zig+6-1| ... | @@ -3051,11 +3051,16 @@ pub const Inst = struct { | ... | @@ -3051,11 +3051,16 @@ pub const Inst = struct { |
| 3051 | var multi_i: u32 = 0; | 3051 | var multi_i: u32 = 0; |
| 3052 | while (true) : (multi_i += 1) { | 3052 | while (true) : (multi_i += 1) { |
| 3053 | const items_len = zir.extra[extra_index]; | 3053 | const items_len = zir.extra[extra_index]; |
| 3054 | extra_index += 2; | 3054 | extra_index += 1; |
| 3055 | const ranges_len = zir.extra[extra_index]; | ||
| 3056 | extra_index += 1; | ||
| 3055 | const body_len = @truncate(u31, zir.extra[extra_index]); | 3057 | const body_len = @truncate(u31, zir.extra[extra_index]); |
| 3056 | extra_index += 1; | 3058 | extra_index += 1; |
| 3057 | const items = zir.refSlice(extra_index, items_len); | 3059 | const items = zir.refSlice(extra_index, items_len); |
| 3058 | extra_index += items_len; | 3060 | extra_index += items_len; |
| 3061 | // Each range has a start and an end. | ||
| 3062 | extra_index += 2 * ranges_len; | ||
| 3063 | |||
| 3059 | const body = zir.extra[extra_index..][0..body_len]; | 3064 | const body = zir.extra[extra_index..][0..body_len]; |
| 3060 | extra_index += body_len; | 3065 | extra_index += body_len; |
| 3061 | 3066 |
test/behavior.zig+1| ... | @@ -95,6 +95,7 @@ test { | ... | @@ -95,6 +95,7 @@ test { |
| 95 | _ = @import("behavior/bugs/12801-1.zig"); | 95 | _ = @import("behavior/bugs/12801-1.zig"); |
| 96 | _ = @import("behavior/bugs/12801-2.zig"); | 96 | _ = @import("behavior/bugs/12801-2.zig"); |
| 97 | _ = @import("behavior/bugs/12885.zig"); | 97 | _ = @import("behavior/bugs/12885.zig"); |
| 98 | _ = @import("behavior/bugs/12890.zig"); | ||
| 98 | _ = @import("behavior/bugs/12911.zig"); | 99 | _ = @import("behavior/bugs/12911.zig"); |
| 99 | _ = @import("behavior/bugs/12928.zig"); | 100 | _ = @import("behavior/bugs/12928.zig"); |
| 100 | _ = @import("behavior/bugs/12945.zig"); | 101 | _ = @import("behavior/bugs/12945.zig"); |
test/behavior/bugs/12890.zig created+18| ... | @@ -0,0 +1,18 @@ | ||
| 1 | const expect = @import("std").testing.expect; | ||
| 2 | const builtin = @import("builtin"); | ||
| 3 | |||
| 4 | fn a(b: []u3, c: u3) void { | ||
| 5 | switch (c) { | ||
| 6 | 0...1 => b[c] = c, | ||
| 7 | 2...3 => b[c] = c, | ||
| 8 | 4...7 => |d| b[d] = c, | ||
| 9 | } | ||
| 10 | } | ||
| 11 | test { | ||
| 12 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | ||
| 13 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 14 | |||
| 15 | var arr: [8]u3 = undefined; | ||
| 16 | a(&arr, 5); | ||
| 17 | try expect(arr[5] == 5); | ||
| 18 | } | ||