zig
zig copied to clipboard
Assertion failure in LLVM backend computing x86_64 calling convention ABI in lowerSystemVFnRetTy
Zig Version
0.13.0-dev.4+c7ffdbcd4
Steps to Reproduce and Observed Behavior
Environment
This was run on a Debian testing system with the following installed:
libsdl2-2.0-0:amd64 (2.30.2+dfsg-1) libsdl2-dev:amd64 (2.30.2+dfsg-1) libsdl2-gfx-1.0-0:amd64 (1.0.4+dfsg-5) libsdl2-gfx-dev:amd64 (1.0.4+dfsg-5) libsdl2-image-2.0-0:amd64 (2.8.2+dfsg-1+b1) libsdl2-image-dev:amd64 (2.8.2+dfsg-1+b1) libsdl2-ttf-2.0-0:amd64 (2.22.0+dfsg-1) libsdl2-ttf-dev:amd64 (2.22.0+dfsg-1)
Also mercurial
Steps
$ hg clone https://hg.sr.ht/~nmichaels/sdl-wrapper
$ cd sdl-wrapper
$ zig build test
Observed Behavior
$ zig build test test └─ run test └─ zig test Debug native failure error: thread 3931 panic: reached unreachable code /home/nathan/zig/ziggit/lib/std/debug.zig:403:14: 0x17f046c in assert (zig) if (!ok) unreachable; // assertion failure ^ /home/nathan/zig/ziggit/src/codegen/llvm.zig:11064:23: 0x269507a in lowerSystemVFnRetTy (zig) assert((std.math.divCeil(u64, size, 8) catch unreachable) == types_index); ^ /home/nathan/zig/ziggit/src/codegen/llvm.zig:10927:55: 0x210061a in lowerFnRetTy (zig) else => return lowerSystemVFnRetTy(o, fn_info), ^ /home/nathan/zig/ziggit/src/codegen/llvm.zig:3602:40: 0x1e98c8c in lowerTypeFn (zig) const ret_ty = try lowerFnRetTy(o, fn_info); ^ /home/nathan/zig/ziggit/src/codegen/llvm.zig:3557:60: 0x1b7ec1d in lowerType (zig) .func_type => |func_type| try o.lowerTypeFn(func_type), ^ /home/nathan/zig/ziggit/src/codegen/llvm.zig:2888:28: 0x18c68b6 in resolveLlvmFunction (zig) try o.lowerType(zig_fn_type), ^ /home/nathan/zig/ziggit/src/codegen/llvm.zig:4603:42: 0x18c5a17 in genDecl (zig) _ = try o.resolveLlvmFunction(extern_func.decl); ^ /home/nathan/zig/ziggit/src/codegen/llvm.zig:1732:19: 0x18e46c5 in updateDecl (zig) dg.genDecl() catch |err| switch (err) { ^ /home/nathan/zig/ziggit/src/link/Elf.zig:3041:70: 0x1b77476 in updateDecl (zig) if (self.llvm_object) |llvm_object| return llvm_object.updateDecl(mod, decl_index); ^ /home/nathan/zig/ziggit/src/link.zig:404:82: 0x18e612a in updateDecl (zig) return @as(*tag.Type(), @fieldParentPtr("base", base)).updateDecl(module, decl_index); ^ /home/nathan/zig/ziggit/src/Module.zig:5450:22: 0x18e5b59 in linkerUpdateDecl (zig) lf.updateDecl(zcu, decl_index) catch |err| switch (err) { ^ /home/nathan/zig/ziggit/src/Compilation.zig:3409:48: 0x1ae5997 in processOneJob (zig) try module.linkerUpdateDecl(decl_index); ^ /home/nathan/zig/ziggit/src/Compilation.zig:3359:30: 0x1914c0a in performAllTheWork (zig) try processOneJob(comp, work_item, main_progress_node); ^ /home/nathan/zig/ziggit/src/Compilation.zig:2132:31: 0x1910142 in update (zig) try comp.performAllTheWork(main_progress_node); ^ /home/nathan/zig/ziggit/src/main.zig:4085:36: 0x198b02c in serve (zig) try comp.update(main_progress_node); ^ /home/nathan/zig/ziggit/src/main.zig:3362:22: 0x19a9761 in buildOutputType (zig) try serve( ^ /home/nathan/zig/ziggit/src/main.zig:266:31: 0x17f28db in mainArgs (zig) return buildOutputType(gpa, arena, args, .zig_test); ^ /home/nathan/zig/ziggit/src/main.zig:206:20: 0x17ef635 in main (zig) return mainArgs(gpa, arena, args); ^ /home/nathan/zig/ziggit/lib/std/start.zig:511:37: 0x17ef0ce in main (zig) const result = root.main() catch |err| { ^ ../sysdeps/nptl/libc_start_call_main.h:58:16: 0x7fd1a7c456c9 in __libc_start_call_main (../sysdeps/x86/libc-start.c) ../csu/libc-start.c:360:3: 0x7fd1a7c45784 in __libc_start_main_impl (../sysdeps/x86/libc-start.c) ???:?:?: 0x17eed10 in ??? (???) ???:?:?: 0x0 in ??? (???)
error: the following command terminated unexpectedly: /home/nathan/local/zig/bin/zig test -lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_gfx -ODebug -Mroot=/home/nathan/zig/sdl-wrapper/src/sdl.zig -lc --cache-dir /home/nathan/zig/sdl-wrapper/zig-cache --global-cache-dir /home/nathan/.cache/zig --name test --listen=- Build Summary: 1/4 steps succeeded; 1 failed (disable with --summary none) test transitive failure └─ run test transitive failure └─ zig test Debug native failure error: the following build command failed with exit code 1: /home/nathan/zig/sdl-wrapper/zig-cache/o/2aa3bceb786969c6584f72c4b2a75396/build /home/nathan/local/zig/bin/zig /home/nathan/zig/sdl-wrapper /home/nathan/zig/sdl-wrapper/zig-cache /home/nathan/.cache/zig --seed 0x92a75514 -Za90721f98c6e5811 test
Expected Behavior
I expected the tests to pass, or fail, or fail to compile because the standard library has changed since I last updated this repo.
But since a different project that depends on this one actually still works and passes its tests, the tests seem likely to pass.