| ... | @@ -18,20 +18,16 @@ test "global variable alignment" { | ... | @@ -18,20 +18,16 @@ test "global variable alignment" { |
| 18 | } | 18 | } |
| 19 | } | 19 | } |
| 20 | | 20 | |
| 21 | test "slicing array of length 1 can assume runtime index is always zero" { | 21 | test "slicing array of length 1 can not assume runtime index is always zero" { |
| 22 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | 22 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; |
| 23 | | 23 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 24 | // TODO reevaluate this test case, because notice that you can | 24 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 25 | // change `runtime_zero` to be `1` and the test still passes for stage1. | | |
| 26 | // Reconsider also this code: | | |
| 27 | // var array: [4]u8 = undefined; | | |
| 28 | // var runtime: usize = 4; | | |
| 29 | // var ptr = array[runtime..]; | | |
| 30 | // _ = ptr; | | |
| 31 | | 25 | |
| 32 | var runtime_zero: usize = 0; | 26 | var runtime_index: usize = 1; |
| 33 | const slice = @as(*align(4) [1]u8, &foo)[runtime_zero..]; | 27 | const slice = @as(*align(4) [1]u8, &foo)[runtime_index..]; |
| 34 | comptime try expect(@TypeOf(slice) == []align(4) u8); | 28 | try expect(@TypeOf(slice) == []u8); |
| | 29 | try expect(slice.len == 0); |
| | 30 | try expect(@truncate(u2, @ptrToInt(slice.ptr) - 1) == 0); |
| 35 | } | 31 | } |
| 36 | | 32 | |
| 37 | test "default alignment allows unspecified in type syntax" { | 33 | test "default alignment allows unspecified in type syntax" { |