mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
parent
c0350cf87e
commit
40578656e8
@ -3051,11 +3051,16 @@ pub const Inst = struct {
|
||||
var multi_i: u32 = 0;
|
||||
while (true) : (multi_i += 1) {
|
||||
const items_len = zir.extra[extra_index];
|
||||
extra_index += 2;
|
||||
extra_index += 1;
|
||||
const ranges_len = zir.extra[extra_index];
|
||||
extra_index += 1;
|
||||
const body_len = @truncate(u31, zir.extra[extra_index]);
|
||||
extra_index += 1;
|
||||
const items = zir.refSlice(extra_index, items_len);
|
||||
extra_index += items_len;
|
||||
// Each range has a start and an end.
|
||||
extra_index += 2 * ranges_len;
|
||||
|
||||
const body = zir.extra[extra_index..][0..body_len];
|
||||
extra_index += body_len;
|
||||
|
||||
|
||||
@ -95,6 +95,7 @@ test {
|
||||
_ = @import("behavior/bugs/12801-1.zig");
|
||||
_ = @import("behavior/bugs/12801-2.zig");
|
||||
_ = @import("behavior/bugs/12885.zig");
|
||||
_ = @import("behavior/bugs/12890.zig");
|
||||
_ = @import("behavior/bugs/12911.zig");
|
||||
_ = @import("behavior/bugs/12928.zig");
|
||||
_ = @import("behavior/bugs/12945.zig");
|
||||
|
||||
18
test/behavior/bugs/12890.zig
Normal file
18
test/behavior/bugs/12890.zig
Normal file
@ -0,0 +1,18 @@
|
||||
const expect = @import("std").testing.expect;
|
||||
const builtin = @import("builtin");
|
||||
|
||||
fn a(b: []u3, c: u3) void {
|
||||
switch (c) {
|
||||
0...1 => b[c] = c,
|
||||
2...3 => b[c] = c,
|
||||
4...7 => |d| b[d] = c,
|
||||
}
|
||||
}
|
||||
test {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
|
||||
var arr: [8]u3 = undefined;
|
||||
a(&arr, 5);
|
||||
try expect(arr[5] == 5);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user