After stage2 rebuilds itself, producing stage3, it no longer passes the behavior tests. In this snippet below you can see:
[nix-shell:~/dev/zig/build-release]$ ninja
[nix-shell:~/dev/zig/build-release]$ ./zig build -p stage2 -Dskip-install-lib-files --prominent-compile-errors -Denable-llvm
[nix-shell:~/dev/zig/build-release]$ ./stage2/bin/zig build -p stage3 -Dskip-install-lib-files -Denable-llvm
[nix-shell:~/dev/zig/build-release]$ ./stage2/bin/zig test ../test/behavior.zig -I../test
Test [20/1244] test.generic function with align param... SKIP
Test [21/1244] test.runtime known array index has best alignment possible... SKIP
Test [24/1244] test.read 128-bit field from default aligned struct in global memory... SKIP
Test [26/1244] test.align(@alignOf(T)) T does not force resolution of T... SKIP
Test [27/1244] test.align(N) on functions... SKIP
Test [60/1244] test.simple coroutine suspend and resume... SKIP
Test [61/1244] test.pass parameter to coroutine... SKIP
Test [62/1244] test.suspend at end of function... SKIP
Test [63/1244] test.local variable in async function... SKIP
Test [64/1244] test.calling an inferred async function... SKIP
Test [65/1244] test.@frameSize... SKIP
Test [66/1244] test.coroutine suspend, resume... SKIP
Test [67/1244] test.coroutine suspend with block... SKIP
Test [68/1244] test.coroutine await... SKIP
Test [69/1244] test.coroutine await early return... SKIP
Test [70/1244] test.async function with dot syntax... SKIP
Test [71/1244] test.async fn pointer in a struct field... SKIP
Test [72/1244] test.@asyncCall with return type... SKIP
Test [73/1244] test.async fn with inferred error set... SKIP
Test [74/1244] test.error return trace across suspend points - early return... SKIP
Test [75/1244] test.error return trace across suspend points - async return... SKIP
Test [76/1244] test.break from suspend... SKIP
Test [77/1244] test.heap allocated async function frame... SKIP
Test [78/1244] test.async function call return value... SKIP
Test [79/1244] test.suspension points inside branching control flow... SKIP
Test [80/1244] test.call async function which has struct return type... SKIP
Test [81/1244] test.pass string literal to async function... SKIP
Test [82/1244] test.await inside an errdefer... SKIP
Test [83/1244] test.try in an async function with error union and non-zero-bit payload... SKIP
Test [84/1244] test.returning a const error from async function... SKIP
Test [85/1244] test.async/await typical usage... SKIP
Test [86/1244] test.alignment of local variables in async functions... SKIP
Test [87/1244] test.no reason to resolve frame still works... SKIP
Test [88/1244] test.async call a generic function... SKIP
Test [89/1244] test.return from suspend block... SKIP
Test [90/1244] test.struct parameter to async function is copied to the frame... SKIP
Test [91/1244] test.cast fn to async fn when it is inferred to be async... SKIP
Test [92/1244] test.cast fn to async fn when it is inferred to be async, awaited direct... SKIP
Test [93/1244] test.await does not force async if callee is blocking... SKIP
Test [94/1244] test.recursive async function... SKIP
Test [95/1244] test.@asyncCall with comptime-known function, but not awaited directly... SKIP
Test [96/1244] test.@asyncCall with actual frame instead of byte buffer... SKIP
Test [97/1244] test.@asyncCall using the result location inside the frame... SKIP
Test [98/1244] test.@TypeOf an async function call of generic fn with error union type... SKIP
Test [99/1244] test.using @TypeOf on a generic function call... SKIP
Test [100/1244] test.recursive call of await @asyncCall with struct return type... SKIP
Test [101/1244] test.nosuspend function call... SKIP
Test [102/1244] test.await used in expression and awaiting fn with no suspend but asyn... SKIP
Test [103/1244] test.await used in expression after a fn call... SKIP
Test [104/1244] test.async fn call used in expression after a fn call... SKIP
Test [105/1244] test.suspend in for loop... SKIP
Test [106/1244] test.suspend in while loop... SKIP
Test [107/1244] test.correctly spill when returning the error union result of another a... SKIP
Test [108/1244] test.spill target expr in a for loop... SKIP
Test [109/1244] test.spill target expr in a for loop, with a var decl in the loop body... SKIP
Test [110/1244] test.async call with @call... SKIP
Test [111/1244] test.async function passed 0-bit arg after non-0-bit arg... SKIP
Test [112/1244] test.async function passed align(16) arg after align(8) arg... SKIP
Test [113/1244] test.async function call resolves target fn frame, comptime func... SKIP
Test [114/1244] test.async function call resolves target fn frame, runtime func... SKIP
Test [115/1244] test.properly spill optional payload capture value... SKIP
Test [116/1244] test.handle defer interfering with return value spill... SKIP
Test [117/1244] test.take address of temporary async frame... SKIP
Test [118/1244] test.nosuspend await... SKIP
Test [119/1244] test.nosuspend on function calls... SKIP
Test [120/1244] test.nosuspend on async function calls... SKIP
Test [121/1244] test.nosuspend resume async function calls... SKIP
Test [122/1244] test.avoid forcing frame alignment resolution implicit cast to *anyopaq... SKIP
Test [123/1244] test.@asyncCall with pass-by-value arguments... SKIP
Test [124/1244] test.@asyncCall with arguments having non-standard alignment... SKIP
Test [139/1244] test.coroutine await struct... SKIP
Test [201/1244] test.extern variable with non-pointer opaque type... SKIP
Test [226/1244] test.bitcast passed as tuple element... SKIP
Test [241/1244] test.issue 529 fixed... SKIP
Test [251/1244] test.bug 920 fixed... SKIP
Test [255/1244] test.bug 1120... SKIP
Test [298/1244] test.fixed... SKIP
Test [301/1244] test_0... SKIP
Test [312/1244] test_0... SKIP
Test [317/1244] test_0... SKIP
Test [326/1244] test.basic invocations... SKIP
Test [328/1244] test.comptime call with bound function as parameter... SKIP
Test [366/1244] test.vector casts... SKIP
Test [367/1244] test.@floatCast cast down... SKIP
Test [419/1244] test.type pun signed and unsigned as array pointer... SKIP
Test [420/1244] test.type pun signed and unsigned as offset many pointer... SKIP
Test [423/1244] test.type pun bits... SKIP
Test [424/1244] test.basic pointer preservation... SKIP
Test [425/1244] test.byte copy preserves linker value... SKIP
Test [426/1244] test.unordered byte copy preserves linker value... SKIP
Test [427/1244] test.shuffle chunks of linker value... SKIP
Test [428/1244] test.dance on linker values... SKIP
Test [429/1244] test.offset array ptr by element size... SKIP
Test [430/1244] test.offset instance by field size... SKIP
Test [431/1244] test.offset field ptr by enclosing array element size... SKIP
Test [439/1244] test.errdefer with payload... SKIP
Test [492/1244] test.comptime err to int of error set with only 1 possible value... SKIP
Test [499/1244] test.optional error set is the same size as error set... SKIP
Test [551/1244] test.call method on bound fn referring to var instance... SKIP
Test [555/1244] test.string literal used as comptime slice is memoized... SKIP
Test [556/1244] test.comptime function with mutable pointer is not memoized... SKIP
Test [557/1244] test.const ptr to comptime mutable data is not memoized... SKIP
Test [560/1244] test.setting backward branch quota just before a generic fn call... SKIP
Test [563/1244] test.array concatenation forces comptime... SKIP
Test [564/1244] test.array multiplication forces comptime... SKIP
Test [598/1244] test.negation f80... SKIP
Test [600/1244] test.eval @setFloatMode at compile-time... SKIP
Test [601/1244] test.float literal at compile time not lossy... SKIP
Test [602/1244] test.f128 at compile time is lossy... SKIP
Test [726/1244] test.remainder division... SKIP
Test [727/1244] test.float remainder division using @rem... SKIP
Test [728/1244] test.float modulo division using @mod... SKIP
Test [731/1244] test.@fabs f80... SKIP
Test [732/1244] test.@floor... SKIP
Test [733/1244] test.@floor f80... SKIP
Test [734/1244] test.@floor f128... SKIP
Test [735/1244] test.@ceil... SKIP
Test [736/1244] test.@ceil f80... SKIP
Test [737/1244] test.@ceil f128... SKIP
Test [738/1244] test.@trunc... SKIP
Test [739/1244] test.@trunc f80... SKIP
Test [740/1244] test.@trunc f128... SKIP
Test [741/1244] test.@round... SKIP
Test [742/1244] test.@round f80... SKIP
Test [743/1244] test.@round f128... SKIP
Test [746/1244] test.NaN comparison f80... SKIP
Test [749/1244] test.signed zeros are represented properly... SKIP
Test [759/1244] test.@mulAdd f80... SKIP
Test [764/1244] test.vector f80... SKIP
Test [811/1244] test.assign null directly to C pointer and test null equality... SKIP
Test [819/1244] test.pointer arithmetic affects the alignment... SKIP
Test [854/1244] test.@shuffle bool... SKIP
Test [862/1244] test.@sizeOf(T) == 0 doesn't force resolving struct size... SKIP
Test [1005/1244] test.initializer list expression... SKIP
Test [1051/1244] test.Type.AnyFrame... SKIP
Test [1080/1244] test.type info: anyframe and anyframe->T... SKIP
Test [1085/1244] test.type info for async frames... SKIP
Test [1236/1244] test.module level assembly... SKIP
Test [1237/1244] test.output constraint modifiers... SKIP
Test [1238/1244] test.alternative constraints... SKIP
Test [1240/1244] test.struct/array/union types as input values... SKIP
1103 passed; 141 skipped; 0 failed.
[nix-shell:~/dev/zig/build-release]$ ./stage3/bin/zig test ../test/behavior.zig -I../test
thread 486566 panic: attempt to index out of bounds
Analyzing ../test/behavior/saturating_arithmetic.zig: behavior/saturating_arithmetic.zig:test.saturating shift-left__struct_2689.testSatShl
%2149 = decl_val("expect")
%2150 = dbg_stmt(2, 23)
%2151 = param_type(%2149, 0)
> %2152 = shl_sat(%2141, %2143)
%2153 = cmp_eq(%2152, %2145)
%2154 = call(.auto, %2149, [%2153])
%2155 = is_non_err(%2154)
%2156 = condbr(%2155, {
%2158 = err_union_payload_unsafe(%2154)
%2161 = break(%2157, %2158)
}, {
%2159 = err_union_code(%2154)
%2160 = ret_node(%2159)
})
For full context, use the command
zig ast-check -t ../test/behavior/saturating_arithmetic.zig
in ../test/behavior/saturating_arithmetic.zig: behavior/saturating_arithmetic.zig:test.saturating shift-left__struct_2689.testSatShl
> %2157 = block({%2149..%2156})
in ../test/behavior/saturating_arithmetic.zig: behavior/saturating_arithmetic.zig:test.saturating shift-left__struct_2689.doTheTest
> %1983 = call(.auto, %1975, [@Zir.Inst.Ref.i8_type, @Zir.Inst.Ref.one, %1980, %1982])
in ../test/behavior/saturating_arithmetic.zig: behavior/saturating_arithmetic.zig:test.saturating shift-left__struct_2689.doTheTest
> %1986 = block({%1975..%1985})
in ../test/behavior/saturating_arithmetic.zig: behavior/saturating_arithmetic.zig:test.saturating shift-left
> %2210 = call(.compile_time, %2208, [])
in ../test/behavior/saturating_arithmetic.zig: behavior/saturating_arithmetic.zig:test.saturating shift-left
> %2213 = block({%2207..%2212})
/home/andy/dev/zig/lib/std/math/big/int.zig:3496:9: 0x377c477 in llshl (zig)
r[dst_i] = carry | @call(.{ .modifier = .always_inline }, math.shr, .{
^
/home/andy/dev/zig/lib/std/math/big/int.zig:1149:14: 0x36384f7 in shiftLeftSat (zig)
llshl(r.limbs[0..], a.limbs[0..a.limbs.len], shift);
^
/home/andy/dev/zig/src/value.zig:3997:35: 0x3637dda in shlSatScalar (zig)
result_bigint.shiftLeftSat(lhs_bigint, shift, info.signedness, info.bits);
^
/home/andy/dev/zig/src/value.zig:3971:28: 0x3638958 in shlSat (zig)
return shlSatScalar(lhs, rhs, ty, arena, target);
^
/home/andy/dev/zig/src/Sema.zig:8765:35: 0x3487140 in zirShl (zig)
try lhs_val.shlSat(rhs_val, lhs_ty, sema.arena, target),
^
/home/andy/dev/zig/src/Sema.zig:893:42: 0x32f648b in analyzeBodyInner (zig)
.shl_sat => try sema.zirShl(block, inst, .shl_sat),
^
/home/andy/dev/zig/src/Sema.zig:610:45: 0x31caf67 in analyzeBodyBreak (zig)
const break_inst = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
^
/home/andy/dev/zig/src/Sema.zig:1210:62: 0x32faa38 in analyzeBodyInner (zig)
const break_data = (try sema.analyzeBodyBreak(block, inline_body)) orelse
^
/home/andy/dev/zig/src/Sema.zig:593:30: 0x32eadf1 in analyzeBody (zig)
_ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
^
/home/andy/dev/zig/src/Sema.zig:5129:33: 0x35dee99 in analyzeCall (zig)
sema.analyzeBody(&child_block, fn_info.body) catch |err| switch (err) {
^
/home/andy/dev/zig/src/Sema.zig:4718:28: 0x34271bf in zirCall (zig)
return sema.analyzeCall(block, func, func_src, call_src, modifier, ensure_result_used, resolved_args);
^
/home/andy/dev/zig/src/Sema.zig:708:62: 0x32ec780 in analyzeBodyInner (zig)
.call => try sema.zirCall(block, inst),
^
/home/andy/dev/zig/src/Sema.zig:610:45: 0x31caf67 in analyzeBodyBreak (zig)
const break_inst = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
^
/home/andy/dev/zig/src/Sema.zig:1210:62: 0x32faa38 in analyzeBodyInner (zig)
const break_data = (try sema.analyzeBodyBreak(block, inline_body)) orelse
^
/home/andy/dev/zig/src/Sema.zig:593:30: 0x32eadf1 in analyzeBody (zig)
_ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
^
/home/andy/dev/zig/src/Sema.zig:5129:33: 0x35dee99 in analyzeCall (zig)
sema.analyzeBody(&child_block, fn_info.body) catch |err| switch (err) {
^
/home/andy/dev/zig/src/Sema.zig:4718:28: 0x34271bf in zirCall (zig)
return sema.analyzeCall(block, func, func_src, call_src, modifier, ensure_result_used, resolved_args);
^
/home/andy/dev/zig/src/Sema.zig:708:62: 0x32ec780 in analyzeBodyInner (zig)
.call => try sema.zirCall(block, inst),
^
/home/andy/dev/zig/src/Sema.zig:4114:34: 0x360b623 in resolveBlockBody (zig)
if (sema.analyzeBodyInner(child_block, body)) |_| {
^
/home/andy/dev/zig/src/Sema.zig:4097:33: 0x34a3955 in zirBlock (zig)
return sema.resolveBlockBody(parent_block, src, &child_block, body, inst, &label.merges);
^
/home/andy/dev/zig/src/Sema.zig:1196:69: 0x32fa70f in analyzeBodyInner (zig)
if (!block.is_comptime) break :blk try sema.zirBlock(block, inst);
^
/home/andy/dev/zig/src/Sema.zig:593:30: 0x32eadf1 in analyzeBody (zig)
_ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
^
/home/andy/dev/zig/src/Module.zig:4838:21: 0x31b4e5e in analyzeFnBody (zig)
sema.analyzeBody(&inner_block, fn_info.body) catch |err| switch (err) {
^
/home/andy/dev/zig/src/Module.zig:3616:40: 0x30654b6 in ensureFuncBodyAnalyzed (zig)
var air = mod.analyzeFnBody(decl, func, sema_arena) catch |err| switch (err) {
^
/home/andy/dev/zig/src/Compilation.zig:2750:42: 0x3063998 in processOneJob (zig)
module.ensureFuncBodyAnalyzed(func) catch |err| switch (err) {
^
/home/andy/dev/zig/src/Compilation.zig:2696:30: 0x2f7c417 in performAllTheWork (zig)
try processOneJob(comp, work_item);
^
/home/andy/dev/zig/src/Compilation.zig:2087:31: 0x2f795ea in update (zig)
try comp.performAllTheWork();
^
/home/andy/dev/zig/src/main.zig:3101:20: 0x2f950a0 in updateModule (zig)
try comp.update();
^
/home/andy/dev/zig/src/main.zig:2788:17: 0x2db7f72 in buildOutputType (zig)
updateModule(gpa, comp, hook) catch |err| switch (err) {
^
/home/andy/dev/zig/src/main.zig:216:31: 0x2d8ca3f in mainArgs (zig)
return buildOutputType(gpa, arena, args, .zig_test);
^
/home/andy/dev/zig/src/main.zig:165:20: 0x2d8c10a in main (zig)
return mainArgs(gpa, arena, args);
^
/home/andy/dev/zig/lib/std/start.zig:583:37: 0x2d8d9c6 in main (zig)
const result = root.main() catch |err| {
^
Aborted (core dumped)
Zig Version:
0.10.0-dev.1855+a315d51c0After stage2 rebuilds itself, producing stage3, it no longer passes the behavior tests. In this snippet below you can see: