Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C ABI tests failing; self-hosted llvm backend is still missing C ABI implementation code #12222

Closed
Tracked by #12368
andrewrk opened this issue Jul 24, 2022 · 0 comments · Fixed by #12395
Closed
Tracked by #12368
Labels
arch-x86_64 64-bit x86 backend-llvm The LLVM backend outputs an LLVM IR Module. bug Observed behavior contradicts documented or intended behavior enhancement Solving this issue will likely involve adding new logic or components to the codebase. frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone

Comments

@andrewrk
Copy link
Member

Zig Version: 0.10.0-dev.3291+4624c8189

Can be reproduced by cd into test/standalone/c_abi and then zig build.

thread 410936 panic: TODO
/home/andy/Downloads/zig/src/codegen/llvm.zig:9345:41: 0x3721fee in codegen.llvm.ParamTypeIterator.nextInner (zig)
                                        @panic("TODO");
                                        ^
/home/andy/Downloads/zig/src/codegen/llvm.zig:9230:25: 0x3712636 in codegen.llvm.ParamTypeIterator.next (zig)
        return nextInner(it, ty);
                        ^
/home/andy/Downloads/zig/src/codegen/llvm.zig:2838:23: 0x351c788 in codegen.llvm.DeclGen.lowerTypeFn (zig)
        while (it.next()) |lowering| switch (lowering) {
                      ^
/home/andy/Downloads/zig/src/codegen/llvm.zig:2798:38: 0x333c15e in codegen.llvm.DeclGen.lowerTypeInner (zig)
            .Fn => return lowerTypeFn(dg, t),
                                     ^
/home/andy/Downloads/zig/src/codegen/llvm.zig:2433:43: 0x3336771 in codegen.llvm.DeclGen.lowerType (zig)
        const llvm_ty = try lowerTypeInner(dg, t);
                                          ^
/home/andy/Downloads/zig/src/codegen/llvm.zig:2251:41: 0x332ed2b in codegen.llvm.DeclGen.resolveLlvmFunction (zig)
        const fn_type = try dg.lowerType(zig_fn_type);
                                        ^
/home/andy/Downloads/zig/src/codegen/llvm.zig:3190:46: 0x3331ff9 in codegen.llvm.DeclGen.lowerValue (zig)
                return dg.resolveLlvmFunction(fn_decl_index);
                                             ^
/home/andy/Downloads/zig/src/codegen/llvm.zig:3963:48: 0x3956191 in codegen.llvm.FuncGen.resolveInst (zig)
        const llvm_val = try self.dg.lowerValue(.{ .ty = ty, .val = val });
                                               ^
/home/andy/Downloads/zig/src/codegen/llvm.zig:4227:45: 0x37391f8 in codegen.llvm.FuncGen.airCall (zig)
        const llvm_fn = try self.resolveInst(pl_op.operand);
                                            ^
/home/andy/Downloads/zig/src/codegen/llvm.zig:4117:55: 0x37169b8 in codegen.llvm.FuncGen.genBody (zig)
                .call              => try self.airCall(inst, .Auto),
                                                      ^
/home/andy/Downloads/zig/src/codegen/llvm.zig:972:19: 0x3710edd in codegen.llvm.Object.updateFunc (zig)
        fg.genBody(air.getMainBody()) catch |err| switch (err) {
                  ^
/home/andy/Downloads/zig/src/link/Elf.zig:2377:74: 0x34cc537 in link.Elf.updateFunc (zig)
        if (self.llvm_object) |llvm_object| return llvm_object.updateFunc(module, func, air, liveness);
                                                                         ^
/home/andy/Downloads/zig/src/link.zig:509:77: 0x32e7a3d in link.File.updateFunc (zig)
            .elf   => return @fieldParentPtr(Elf,   "base", base).updateFunc(module, func, air, liveness),
                                                                            ^
/home/andy/Downloads/zig/src/Module.zig:4140:41: 0x32c7d45 in Module.ensureFuncBodyAnalyzed (zig)
            mod.comp.bin_file.updateFunc(mod, func, air, liveness) catch |err| switch (err) {
                                        ^
/home/andy/Downloads/zig/src/Compilation.zig:2979:42: 0x2ff81aa in Compilation.processOneJob (zig)
            module.ensureFuncBodyAnalyzed(func) catch |err| switch (err) {
                                         ^
/home/andy/Downloads/zig/src/Compilation.zig:2911:30: 0x2fe1d1d in Compilation.performAllTheWork (zig)
            try processOneJob(comp, work_item);
                             ^
/home/andy/Downloads/zig/src/Compilation.zig:2251:31: 0x2fda1f3 in Compilation.update (zig)
    try comp.performAllTheWork(main_progress_node);
                              ^
/home/andy/Downloads/zig/src/main.zig:3305:20: 0x2f452bf in updateModule (zig)
    try comp.update();
                   ^
/home/andy/Downloads/zig/src/main.zig:2994:17: 0x2f0d085 in buildOutputType (zig)
    updateModule(gpa, comp, hook) catch |err| switch (err) {
                ^
/home/andy/Downloads/zig/src/main.zig:225:31: 0x2ef0fd6 in mainArgs (zig)
        return buildOutputType(gpa, arena, args, .zig_test);
                              ^
/home/andy/Downloads/zig/src/main.zig:174:20: 0x2ef0024 in main (zig)
    return mainArgs(gpa, arena, args);
                   ^
/home/andy/Downloads/zig/lib/std/start.zig:580:37: 0x2ef28ef in std.start.main (zig)
            const result = root.main() catch |err| {
                                    ^
error: test...
error: The following command terminated unexpectedly:
/home/andy/Downloads/zig/build-release/stage2/bin/zig test /home/andy/Downloads/zig/test/stage1/c_abi/main.zig /home/andy/Downloads/zig/test/stage1/c_abi/zig-cache/o/d0cfaaa82bdd8732d3090be48e387c1f/cfuncs.o -lc --cache-dir /home/andy/Downloads/zig/test/stage1/c_abi/zig-cache --global-cache-dir /home/andy/.cache/zig --name test --enable-cache 

Don't forget to re-enable the test case when fixing this.

@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior enhancement Solving this issue will likely involve adding new logic or components to the codebase. frontend Tokenization, parsing, AstGen, Sema, and Liveness. arch-x86_64 64-bit x86 backend-llvm The LLVM backend outputs an LLVM IR Module. labels Jul 24, 2022
@andrewrk andrewrk added this to the 0.10.0 milestone Jul 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-x86_64 64-bit x86 backend-llvm The LLVM backend outputs an LLVM IR Module. bug Observed behavior contradicts documented or intended behavior enhancement Solving this issue will likely involve adding new logic or components to the codebase. frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant