zig icon indicating copy to clipboard operation
zig copied to clipboard

debug info regression

Open nektro opened this issue 1 year ago • 3 comments

Zig Version

0.10.0-dev.2998+a45592715

Steps to Reproduce

the following code tries to produce an enum with undefined fields and produces an ICE

const std = @import("std");

test {
    comptime var fields: [2]std.builtin.Type.EnumField = undefined;
    _ = @Type(.{ .Enum = .{
        .layout = .Auto,
        .tag_type = u1,
        .fields = &fields,
        .decls = &.{},
        .is_exhaustive = true,
    } });
}

Expected Behavior

proper line info for all stack trace items

Actual Behavior

line info missing in cpp code

Assertion failed at /home/meg/other/dev/zig/src/stage1/ir.cpp:19465 in type_info_to_type. This is a bug in the Zig compiler.thread 24563 panic: 
/home/meg/other/dev/zig/src/stage1.zig:178:5: 0xaeb037 in stage2_panic (zig1)
    @panic(ptr[0..len]);
    ^
???:?:?: 0x1d89c1d in zig_panic (/home/meg/other/dev/zig/src/stage1/stage1.cpp)
???:?:?: 0x1ddba59 in zig_assert (/home/meg/other/dev/zig/src/stage1/stage1.cpp)
???:?:?: 0x1e21e27 in type_info_to_type (/home/meg/other/dev/zig/src/stage1/stage1.cpp)
???:?:?: 0x1e233e8 in ir_analyze_instruction_type (/home/meg/other/dev/zig/src/stage1/stage1.cpp)
???:?:?: 0x1e37bf4 in ir_analyze_instruction_base (/home/meg/other/dev/zig/src/stage1/stage1.cpp)
???:?:?: 0x1e383c5 in ir_analyze (/home/meg/other/dev/zig/src/stage1/stage1.cpp)
???:?:?: 0x1e796b1 in analyze_fn_ir (/home/meg/other/dev/zig/src/stage1/stage1.cpp)
???:?:?: 0x1e79c39 in analyze_fn_body (/home/meg/other/dev/zig/src/stage1/stage1.cpp)
???:?:?: 0x1e7a3b9 in semantic_analyze (/home/meg/other/dev/zig/src/stage1/stage1.cpp)
???:?:?: 0x1db4ff6 in gen_root_source (/home/meg/other/dev/zig/src/stage1/stage1.cpp)
???:?:?: 0x1db5355 in codegen_build_object (/home/meg/other/dev/zig/src/stage1/stage1.cpp)
???:?:?: 0x1d85d48 in zig_stage1_build_object (/home/meg/other/dev/zig/src/stage1/stage1.cpp)
/home/meg/other/dev/zig/src/stage1.zig:149:32: 0xec2844 in Module.build_object (zig1)
        zig_stage1_build_object(mod);
                               ^
/home/meg/other/dev/zig/src/Compilation.zig:5226:31: 0xc6630e in Compilation.updateStage1Module (zig1)
    stage1_module.build_object();
                              ^
/home/meg/other/dev/zig/src/Compilation.zig:2876:32: 0xc59c30 in Compilation.performAllTheWork (zig1)
        comp.updateStage1Module(main_progress_node) catch |err| {
                               ^
/home/meg/other/dev/zig/src/Compilation.zig:2243:31: 0xc527ed in Compilation.update (zig1)
    try comp.performAllTheWork(main_progress_node);
                              ^
/home/meg/other/dev/zig/src/main.zig:3288:20: 0xbe18ef in main.updateModule (zig1)
    try comp.update();
                   ^
/home/meg/other/dev/zig/src/main.zig:2977:17: 0xb3cbe3 in main.buildOutputType (zig1)
    updateModule(gpa, comp, hook) catch |err| switch (err) {
                ^
/home/meg/other/dev/zig/src/main.zig:225:31: 0xae9816 in main.mainArgs (zig1)
        return buildOutputType(gpa, arena, args, .zig_test);
                              ^
/home/meg/other/dev/zig/src/stage1.zig:48:24: 0xae8fa9 in main (zig1)
        stage2.mainArgs(gpa, arena, args) catch unreachable;
                       ^
???:?:?: 0x7fbffe89b236 in ??? (???)
???:?:?: 0x7ffd9e92bdd3 in ??? (???)
Aborted (core dumped)

nektro avatar Jul 14 '22 19:07 nektro

Duplicate of #11981.

Vexu avatar Jul 14 '22 19:07 Vexu

the compiler crash isnt what the issue is about

nektro avatar Jul 14 '22 19:07 nektro

In that case it might be duplicate of #12120

Vexu avatar Jul 14 '22 19:07 Vexu

Stage1 has been deleted and I get a proper stack trace from the stage2 crash.

Vexu avatar Dec 31 '22 12:12 Vexu