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

x86_64 backend crashes on boolean switch #17618

Closed
Tracked by #17748
david4r4 opened this issue Oct 19, 2023 · 1 comment · Fixed by #17788
Closed
Tracked by #17748

x86_64 backend crashes on boolean switch #17618

david4r4 opened this issue Oct 19, 2023 · 1 comment · Fixed by #17788
Labels
arch-x86_64 64-bit x86 backend-self-hosted bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@david4r4
Copy link
Contributor

Zig Version

0.12.0-dev.1138+530dc0405

Steps to Reproduce and Observed Behavior

git clone https://github.com/birth-software/nativity
cd nativity
git switch zig-x86_64-backend
zig build

In genBinOpMir, the enum value which triggers the unreachable is .eflags.

/home/david/dev/zig/build-debug/stage3/bin/zig build-exe -fno-llvm -fno-lld /home/david/dev/nativity/src/main.zig --cache-dir /home/david/dev/nativity/zig-cache --global-cache-dir /home/david/.cache/zig --name nativity 
thread 9059 panic: reached unreachable code
Analyzing src/data_structures.zig: data_structures.zig:BlockList(Compilation.File).append
      %605 = dbg_block_begin()
      %606 = dbg_stmt(2, 28)
      %607 = ref(%595)
      %608 = dbg_stmt(2, 36)
      %609 = dbg_stmt(2, 43)
      %610 = field_call(.auto, %607, "addOne", [
        {
          %611 = break_inline(%610, %598)
        },
      ])
    > %612 = try(%610, {
        %613 = err_union_code(%610)
        %614 = dbg_stmt(2, 28)
        %615 = ret_node(%613)
      })
      %616 = dbg_var_val(%612, "result")
      %617 = save_err_ret_index(%612)
      %618 = dbg_stmt(3, 13)
      %619 = dbg_stmt(3, 19)
      %620 = field_val(%612, "ptr")
      %621 = validate_deref(%620)
      %622 = store_node(%620, %601)
      %623 = dbg_stmt(4, 13)
      %624 = ret_type()
      %625 = as_node(%624, %612)
      %626 = dbg_stmt(4, 13)
      %627 = restore_err_ret_index(%4294967211, %625)
      %628 = ret_node(%625)
      %629 = dbg_block_end()
      %630 = restore_err_ret_index(%604, %4294967211)
      %631 = break(%604, @InternPool.Index.void_value)
    For full context, use the command
      zig ast-check -t src/data_structures.zig

  in src/data_structures.zig: data_structures.zig:BlockList(Compilation.File).append
    > %604 = block({%605..%631})
  in src/Compilation.zig: Compilation.zig:Module.getFile
    > %2096 = try(%2086, {%2097..%2099}) node_offset:552:41 to :552:44
  in src/Compilation.zig: Compilation.zig:Module.getFile
    > %2078 = block({%2079..%2140}) node_offset:551:22 to :551:22
  in src/Compilation.zig: Compilation.zig:Module.getFile
    > %2046 = switch_block(%2044,
        @InternPool.Index.bool_true => {%2047..%2076},
        @InternPool.Index.bool_false => {%2077..%2142}) node_offset:542:35 to :542:41
  in src/Compilation.zig: Compilation.zig:Module.getFile
    > %2023 = block({%2024..%2170}) node_offset:540:142 to :540:142
  in src/Compilation.zig: Compilation.zig:Module.importPackage
    > %2240 = try(%2233, {%2241..%2243}) node_offset:576:29 to :576:99
  in src/Compilation.zig: Compilation.zig:Module.importPackage
    > %2189 = block({%2190..%2273}) node_offset:573:105 to :573:105
  in src/Compilation.zig: Compilation.zig:compileModule
    > %3329 = try(%3313, {%3330..%3332}) node_offset:725:9 to :725:108
  in src/Compilation.zig: Compilation.zig:compileModule
    > %2885 = block({%2886..%3818}) node_offset:654:86 to :654:86
  in src/main.zig: main.zig:main
    > %72 = try(%70, {%73..%75})
  in src/main.zig: main.zig:main
    > %33 = block({%34..%79})
  in /home/david/dev/zig/lib/std/start.zig: start.zig:callMain
    > %2830 = is_non_err(%2829)
  in /home/david/dev/zig/lib/std/start.zig: start.zig:callMain
    > %2832 = block({%2826..%2831})
  in /home/david/dev/zig/lib/std/start.zig: start.zig:callMain
    > %2823 = block({%2824..%2970})
  in /home/david/dev/zig/lib/std/start.zig: start.zig:callMain
    > %2734 = switch_block(%2732,
        else => {%2973..%2979},
        %2735 => {%2736..%2748},
        %2749 => {%2750..%2768},
        by_val %2769 => {%2770..%2820},
        %2821 => {%2822..%2972})
  in /home/david/dev/zig/lib/std/start.zig: start.zig:callMain
    > %2718 = block({%2719..%2983})
  in /home/david/dev/zig/lib/std/start.zig: start.zig:initEventLoopAndCallMain
    > %2441 = builtin_call(%2439, %2440, @InternPool.Index.empty_struct)
  in /home/david/dev/zig/lib/std/start.zig: start.zig:initEventLoopAndCallMain
    > %2286 = block({%2287..%2448})
  in /home/david/dev/zig/lib/std/start.zig: start.zig:callMainWithArgs
    > %2063 = call(.auto, %2061, [])
  in /home/david/dev/zig/lib/std/start.zig: start.zig:callMainWithArgs
    > %2026 = block({%2027..%2070})
  in /home/david/dev/zig/lib/std/start.zig: start.zig:posixCallMainAndExit
    > %1852 = builtin_call(%1849, %1850, %1851)
  in /home/david/dev/zig/lib/std/start.zig: start.zig:posixCallMainAndExit
    > %1848 = field_call(nodiscard .auto, %1845, "exit", [
        {%1849..%1853},
      ])
  in /home/david/dev/zig/lib/std/start.zig: start.zig:posixCallMainAndExit
    > %1457 = block({%1458..%1856})

/home/david/dev/zig/src/arch/x86_64/CodeGen.zig:8437:12: 0x5c93fc6 in genBinOpMir (zig)
        => unreachable, // unmodifiable destination
           ^
/home/david/dev/zig/src/arch/x86_64/CodeGen.zig:10317:33: 0x5d67d4b in airSwitchBr (zig)
            try self.genBinOpMir(.{ ._, .cmp }, condition_ty, condition, item_mcv);
                                ^
/home/david/dev/zig/src/arch/x86_64/CodeGen.zig:2097:53: 0x58e3564 in genBody (zig)
            .switch_br       => try self.airSwitchBr(inst),
                                                    ^
/home/david/dev/zig/src/arch/x86_64/CodeGen.zig:10263:21: 0x5d210b0 in airBlock (zig)
    try self.genBody(body);
                    ^
/home/david/dev/zig/src/arch/x86_64/CodeGen.zig:2005:50: 0x58e1652 in genBody (zig)
            .block           => try self.airBlock(inst),
                                                 ^
/home/david/dev/zig/src/arch/x86_64/CodeGen.zig:1787:25: 0x53cfbaf in gen (zig)
        try self.genBody(self.air.getMainBody());
                        ^
/home/david/dev/zig/src/arch/x86_64/CodeGen.zig:866:17: 0x4ecb951 in generate (zig)
    function.gen() catch |err| switch (err) {
                ^
/home/david/dev/zig/src/codegen.zig:66:70: 0x49ef2f7 in generateFunction (zig)
        .x86_64 => return @import("arch/x86_64/CodeGen.zig").generate(bin_file, src_loc, func_index, air, liveness, code, debug_output),
                                                                     ^
/home/david/dev/zig/src/link/Elf.zig:3277:37: 0x49efb79 in updateFunc (zig)
        try codegen.generateFunction(&self.base, decl.srcLoc(mod), func_index, air, liveness, &code_buffer, .{
                                    ^
/home/david/dev/zig/src/link.zig:621:77: 0x46b9480 in updateFunc (zig)
            .elf   => return @fieldParentPtr(Elf,   "base", base).updateFunc(module, func_index, air, liveness),
                                                                            ^
/home/david/dev/zig/src/Module.zig:3467:37: 0x4438ff7 in ensureFuncBodyAnalyzed (zig)
            comp.bin_file.updateFunc(mod, func_index, air, liveness) catch |err| switch (err) {
                                    ^
/home/david/dev/zig/src/Sema.zig:31742:31: 0x5094ec0 in ensureFuncBodyAnalyzed (zig)
    mod.ensureFuncBodyAnalyzed(func) catch |err| {
                              ^
/home/david/dev/zig/src/Sema.zig:35487:40: 0x4b24a0d in resolveInferredErrorSet (zig)
        try sema.ensureFuncBodyAnalyzed(func_index);
                                       ^
/home/david/dev/zig/src/Sema.zig:32097:69: 0x4af95ba in analyzeIsNonErrComptimeOnly (zig)
                const resolved_ty = try sema.resolveInferredErrorSet(block, src, set_ty);
                                                                    ^
/home/david/dev/zig/src/Sema.zig:18462:60: 0x4af8209 in zirTry (zig)
    const is_non_err = try sema.analyzeIsNonErrComptimeOnly(parent_block, operand_src, err_union);
                                                           ^
/home/david/dev/zig/src/Sema.zig:1729:67: 0x46e895a in analyzeBodyInner (zig)
                if (!block.is_comptime) break :blk try sema.zirTry(block, inst);
                                                                  ^
/home/david/dev/zig/src/Sema.zig:5897:34: 0x507296b in resolveBlockBody (zig)
        if (sema.analyzeBodyInner(child_block, body)) |_| {
                                 ^
/home/david/dev/zig/src/Sema.zig:5880:33: 0x4afd0b4 in zirBlock (zig)
    return sema.resolveBlockBody(parent_block, src, &child_block, body, inst, &label.merges);
                                ^
/home/david/dev/zig/src/Sema.zig:1578:49: 0x46ea4ef in analyzeBodyInner (zig)
                    break :blk try sema.zirBlock(block, inst, tags[inst] == .block_comptime);
                                                ^
/home/david/dev/zig/src/Sema.zig:917:30: 0x49cdbf8 in analyzeBody (zig)
    _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                             ^
/home/david/dev/zig/src/Module.zig:4825:21: 0x46b7466 in analyzeFnBody (zig)
    sema.analyzeBody(&inner_block, fn_info.body) catch |err| switch (err) {
                    ^
/home/david/dev/zig/src/Module.zig:3401:40: 0x44385cd in ensureFuncBodyAnalyzed (zig)
            var air = mod.analyzeFnBody(func_index, sema_arena) catch |err| switch (err) {
                                       ^
/home/david/dev/zig/src/Sema.zig:31742:31: 0x5094ec0 in ensureFuncBodyAnalyzed (zig)
    mod.ensureFuncBodyAnalyzed(func) catch |err| {
                              ^
/home/david/dev/zig/src/Sema.zig:35487:40: 0x4b24a0d in resolveInferredErrorSet (zig)
        try sema.ensureFuncBodyAnalyzed(func_index);
                                       ^
/home/david/dev/zig/src/Sema.zig:32097:69: 0x4af95ba in analyzeIsNonErrComptimeOnly (zig)
                const resolved_ty = try sema.resolveInferredErrorSet(block, src, set_ty);
                                                                    ^
/home/david/dev/zig/src/Sema.zig:18462:60: 0x4af8209 in zirTry (zig)
    const is_non_err = try sema.analyzeIsNonErrComptimeOnly(parent_block, operand_src, err_union);
                                                           ^
/home/david/dev/zig/src/Sema.zig:1729:67: 0x46e895a in analyzeBodyInner (zig)
                if (!block.is_comptime) break :blk try sema.zirTry(block, inst);
                                                                  ^
/home/david/dev/zig/src/Sema.zig:5897:34: 0x507296b in resolveBlockBody (zig)
        if (sema.analyzeBodyInner(child_block, body)) |_| {
                                 ^
/home/david/dev/zig/src/Sema.zig:5880:33: 0x4afd0b4 in zirBlock (zig)
    return sema.resolveBlockBody(parent_block, src, &child_block, body, inst, &label.merges);
                                ^
/home/david/dev/zig/src/Sema.zig:1578:49: 0x46ea4ef in analyzeBodyInner (zig)
                    break :blk try sema.zirBlock(block, inst, tags[inst] == .block_comptime);
                                                ^
/home/david/dev/zig/src/Sema.zig:897:30: 0x50717bb in analyzeBodyRuntimeBreak (zig)
    _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                             ^
/home/david/dev/zig/src/Sema.zig:10689:52: 0x4ff37c1 in analyzeProngRuntime (zig)
                return sema.analyzeBodyRuntimeBreak(case_block, prong_body);
                                                   ^
/home/david/dev/zig/src/Sema.zig:12038:40: 0x4a56b4b in zirSwitchBlock (zig)
            try spa.analyzeProngRuntime(
                                       ^
/home/david/dev/zig/src/Sema.zig:1095:69: 0x46dc857 in analyzeBodyInner (zig)
            .switch_block                 => try sema.zirSwitchBlock(block, inst, false),
                                                                    ^
/home/david/dev/zig/src/Sema.zig:5897:34: 0x507296b in resolveBlockBody (zig)
        if (sema.analyzeBodyInner(child_block, body)) |_| {
                                 ^
/home/david/dev/zig/src/Sema.zig:5880:33: 0x4afd0b4 in zirBlock (zig)
    return sema.resolveBlockBody(parent_block, src, &child_block, body, inst, &label.merges);
                                ^
/home/david/dev/zig/src/Sema.zig:1578:49: 0x46ea4ef in analyzeBodyInner (zig)
                    break :blk try sema.zirBlock(block, inst, tags[inst] == .block_comptime);
                                                ^
/home/david/dev/zig/src/Sema.zig:917:30: 0x49cdbf8 in analyzeBody (zig)
    _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                             ^
/home/david/dev/zig/src/Module.zig:4825:21: 0x46b7466 in analyzeFnBody (zig)
    sema.analyzeBody(&inner_block, fn_info.body) catch |err| switch (err) {
                    ^
/home/david/dev/zig/src/Module.zig:3401:40: 0x44385cd in ensureFuncBodyAnalyzed (zig)
            var air = mod.analyzeFnBody(func_index, sema_arena) catch |err| switch (err) {
                                       ^
/home/david/dev/zig/src/Sema.zig:31742:31: 0x5094ec0 in ensureFuncBodyAnalyzed (zig)
    mod.ensureFuncBodyAnalyzed(func) catch |err| {
                              ^
/home/david/dev/zig/src/Sema.zig:35487:40: 0x4b24a0d in resolveInferredErrorSet (zig)
        try sema.ensureFuncBodyAnalyzed(func_index);
                                       ^
/home/david/dev/zig/src/Sema.zig:32097:69: 0x4af95ba in analyzeIsNonErrComptimeOnly (zig)
                const resolved_ty = try sema.resolveInferredErrorSet(block, src, set_ty);
                                                                    ^
/home/david/dev/zig/src/Sema.zig:18462:60: 0x4af8209 in zirTry (zig)
    const is_non_err = try sema.analyzeIsNonErrComptimeOnly(parent_block, operand_src, err_union);
                                                           ^
/home/david/dev/zig/src/Sema.zig:1729:67: 0x46e895a in analyzeBodyInner (zig)
                if (!block.is_comptime) break :blk try sema.zirTry(block, inst);
                                                                  ^
/home/david/dev/zig/src/Sema.zig:5897:34: 0x507296b in resolveBlockBody (zig)
        if (sema.analyzeBodyInner(child_block, body)) |_| {
                                 ^
/home/david/dev/zig/src/Sema.zig:5880:33: 0x4afd0b4 in zirBlock (zig)
    return sema.resolveBlockBody(parent_block, src, &child_block, body, inst, &label.merges);
                                ^
/home/david/dev/zig/src/Sema.zig:1578:49: 0x46ea4ef in analyzeBodyInner (zig)
                    break :blk try sema.zirBlock(block, inst, tags[inst] == .block_comptime);
                                                ^
/home/david/dev/zig/src/Sema.zig:917:30: 0x49cdbf8 in analyzeBody (zig)
    _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                             ^
/home/david/dev/zig/src/Module.zig:4825:21: 0x46b7466 in analyzeFnBody (zig)
    sema.analyzeBody(&inner_block, fn_info.body) catch |err| switch (err) {
                    ^
/home/david/dev/zig/src/Module.zig:3401:40: 0x44385cd in ensureFuncBodyAnalyzed (zig)
            var air = mod.analyzeFnBody(func_index, sema_arena) catch |err| switch (err) {
                                       ^
/home/david/dev/zig/src/Sema.zig:31742:31: 0x5094ec0 in ensureFuncBodyAnalyzed (zig)
    mod.ensureFuncBodyAnalyzed(func) catch |err| {
                              ^
/home/david/dev/zig/src/Sema.zig:35487:40: 0x4b24a0d in resolveInferredErrorSet (zig)
        try sema.ensureFuncBodyAnalyzed(func_index);
                                       ^
/home/david/dev/zig/src/Sema.zig:32097:69: 0x4af95ba in analyzeIsNonErrComptimeOnly (zig)
                const resolved_ty = try sema.resolveInferredErrorSet(block, src, set_ty);
                                                                    ^
/home/david/dev/zig/src/Sema.zig:18462:60: 0x4af8209 in zirTry (zig)
    const is_non_err = try sema.analyzeIsNonErrComptimeOnly(parent_block, operand_src, err_union);
                                                           ^
/home/david/dev/zig/src/Sema.zig:1729:67: 0x46e895a in analyzeBodyInner (zig)
                if (!block.is_comptime) break :blk try sema.zirTry(block, inst);
                                                                  ^
/home/david/dev/zig/src/Sema.zig:5897:34: 0x507296b in resolveBlockBody (zig)
        if (sema.analyzeBodyInner(child_block, body)) |_| {
                                 ^
/home/david/dev/zig/src/Sema.zig:5880:33: 0x4afd0b4 in zirBlock (zig)
    return sema.resolveBlockBody(parent_block, src, &child_block, body, inst, &label.merges);
                                ^
/home/david/dev/zig/src/Sema.zig:1578:49: 0x46ea4ef in analyzeBodyInner (zig)
                    break :blk try sema.zirBlock(block, inst, tags[inst] == .block_comptime);
                                                ^
/home/david/dev/zig/src/Sema.zig:917:30: 0x49cdbf8 in analyzeBody (zig)
    _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                             ^
/home/david/dev/zig/src/Module.zig:4825:21: 0x46b7466 in analyzeFnBody (zig)
    sema.analyzeBody(&inner_block, fn_info.body) catch |err| switch (err) {
                    ^
/home/david/dev/zig/src/Module.zig:3401:40: 0x44385cd in ensureFuncBodyAnalyzed (zig)
            var air = mod.analyzeFnBody(func_index, sema_arena) catch |err| switch (err) {
                                       ^
/home/david/dev/zig/src/Sema.zig:31742:31: 0x5094ec0 in ensureFuncBodyAnalyzed (zig)
    mod.ensureFuncBodyAnalyzed(func) catch |err| {
                              ^
/home/david/dev/zig/src/Sema.zig:35487:40: 0x4b24a0d in resolveInferredErrorSet (zig)
        try sema.ensureFuncBodyAnalyzed(func_index);
                                       ^
/home/david/dev/zig/src/Sema.zig:32097:69: 0x4af95ba in analyzeIsNonErrComptimeOnly (zig)
                const resolved_ty = try sema.resolveInferredErrorSet(block, src, set_ty);
                                                                    ^
/home/david/dev/zig/src/Sema.zig:18462:60: 0x4af8209 in zirTry (zig)
    const is_non_err = try sema.analyzeIsNonErrComptimeOnly(parent_block, operand_src, err_union);
                                                           ^
/home/david/dev/zig/src/Sema.zig:1729:67: 0x46e895a in analyzeBodyInner (zig)
                if (!block.is_comptime) break :blk try sema.zirTry(block, inst);
                                                                  ^
/home/david/dev/zig/src/Sema.zig:5897:34: 0x507296b in resolveBlockBody (zig)
        if (sema.analyzeBodyInner(child_block, body)) |_| {
                                 ^
/home/david/dev/zig/src/Sema.zig:5880:33: 0x4afd0b4 in zirBlock (zig)
    return sema.resolveBlockBody(parent_block, src, &child_block, body, inst, &label.merges);
                                ^
/home/david/dev/zig/src/Sema.zig:1578:49: 0x46ea4ef in analyzeBodyInner (zig)
                    break :blk try sema.zirBlock(block, inst, tags[inst] == .block_comptime);
                                                ^
/home/david/dev/zig/src/Sema.zig:917:30: 0x49cdbf8 in analyzeBody (zig)
    _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                             ^
/home/david/dev/zig/src/Module.zig:4825:21: 0x46b7466 in analyzeFnBody (zig)
    sema.analyzeBody(&inner_block, fn_info.body) catch |err| switch (err) {
                    ^
/home/david/dev/zig/src/Module.zig:3401:40: 0x44385cd in ensureFuncBodyAnalyzed (zig)
            var air = mod.analyzeFnBody(func_index, sema_arena) catch |err| switch (err) {
                                       ^
/home/david/dev/zig/src/Sema.zig:31742:31: 0x5094ec0 in ensureFuncBodyAnalyzed (zig)
    mod.ensureFuncBodyAnalyzed(func) catch |err| {
                              ^
/home/david/dev/zig/src/Sema.zig:35487:40: 0x4b24a0d in resolveInferredErrorSet (zig)
        try sema.ensureFuncBodyAnalyzed(func_index);
                                       ^
/home/david/dev/zig/src/Sema.zig:32097:69: 0x4af95ba in analyzeIsNonErrComptimeOnly (zig)
                const resolved_ty = try sema.resolveInferredErrorSet(block, src, set_ty);
                                                                    ^
/home/david/dev/zig/src/Sema.zig:32126:56: 0x4fd2eac in analyzeIsNonErr (zig)
    const result = try sema.analyzeIsNonErrComptimeOnly(block, src, operand);
                                                       ^
/home/david/dev/zig/src/Sema.zig:18346:32: 0x4a42255 in zirIsNonErr (zig)
    return sema.analyzeIsNonErr(block, src, operand);
                               ^
/home/david/dev/zig/src/Sema.zig:1072:66: 0x46db762 in analyzeBodyInner (zig)
            .is_non_err                   => try sema.zirIsNonErr(block, inst),
                                                                 ^
/home/david/dev/zig/src/Sema.zig:5897:34: 0x507296b in resolveBlockBody (zig)
        if (sema.analyzeBodyInner(child_block, body)) |_| {
                                 ^
/home/david/dev/zig/src/Sema.zig:5880:33: 0x4afd0b4 in zirBlock (zig)
    return sema.resolveBlockBody(parent_block, src, &child_block, body, inst, &label.merges);
                                ^
/home/david/dev/zig/src/Sema.zig:1578:49: 0x46ea4ef in analyzeBodyInner (zig)
                    break :blk try sema.zirBlock(block, inst, tags[inst] == .block_comptime);
                                                ^
/home/david/dev/zig/src/Sema.zig:5897:34: 0x507296b in resolveBlockBody (zig)
        if (sema.analyzeBodyInner(child_block, body)) |_| {
                                 ^
/home/david/dev/zig/src/Sema.zig:5880:33: 0x4afd0b4 in zirBlock (zig)
    return sema.resolveBlockBody(parent_block, src, &child_block, body, inst, &label.merges);
                                ^
/home/david/dev/zig/src/Sema.zig:1578:49: 0x46ea4ef in analyzeBodyInner (zig)
                    break :blk try sema.zirBlock(block, inst, tags[inst] == .block_comptime);
                                                ^
/home/david/dev/zig/src/Sema.zig:5897:34: 0x507296b in resolveBlockBody (zig)
        if (sema.analyzeBodyInner(child_block, body)) |_| {
                                 ^
/home/david/dev/zig/src/Sema.zig:10633:45: 0x4ff2a6f in resolveProngComptime (zig)
                return sema.resolveBlockBody(spa.parent_block, src, child_block, prong_body, spa.switch_block_inst, merges);
                                            ^
/home/david/dev/zig/src/Sema.zig:11867:52: 0x4a53b17 in zirSwitchBlock (zig)
                    return spa.resolveProngComptime(
                                                   ^
/home/david/dev/zig/src/Sema.zig:1095:69: 0x46dc857 in analyzeBodyInner (zig)
            .switch_block                 => try sema.zirSwitchBlock(block, inst, false),
                                                                    ^
/home/david/dev/zig/src/Sema.zig:5897:34: 0x507296b in resolveBlockBody (zig)
        if (sema.analyzeBodyInner(child_block, body)) |_| {
                                 ^
/home/david/dev/zig/src/Sema.zig:5880:33: 0x4afd0b4 in zirBlock (zig)
    return sema.resolveBlockBody(parent_block, src, &child_block, body, inst, &label.merges);
                                ^
/home/david/dev/zig/src/Sema.zig:1578:49: 0x46ea4ef in analyzeBodyInner (zig)
                    break :blk try sema.zirBlock(block, inst, tags[inst] == .block_comptime);
                                                ^
/home/david/dev/zig/src/Sema.zig:917:30: 0x49cdbf8 in analyzeBody (zig)
    _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                             ^
/home/david/dev/zig/src/Sema.zig:7516:33: 0x4fbf351 in analyzeCall (zig)
                sema.analyzeBody(&child_block, fn_info.body) catch |err| switch (err) {
                                ^
/home/david/dev/zig/src/Sema.zig:24005:28: 0x4a95149 in zirBuiltinCall (zig)
    return sema.analyzeCall(
                           ^
/home/david/dev/zig/src/Sema.zig:1147:69: 0x46deeae in analyzeBodyInner (zig)
            .builtin_call                 => try sema.zirBuiltinCall(block, inst),
                                                                    ^
/home/david/dev/zig/src/Sema.zig:5897:34: 0x507296b in resolveBlockBody (zig)
        if (sema.analyzeBodyInner(child_block, body)) |_| {
                                 ^
/home/david/dev/zig/src/Sema.zig:5880:33: 0x4afd0b4 in zirBlock (zig)
    return sema.resolveBlockBody(parent_block, src, &child_block, body, inst, &label.merges);
                                ^
/home/david/dev/zig/src/Sema.zig:1578:49: 0x46ea4ef in analyzeBodyInner (zig)
                    break :blk try sema.zirBlock(block, inst, tags[inst] == .block_comptime);
                                                ^
/home/david/dev/zig/src/Sema.zig:917:30: 0x49cdbf8 in analyzeBody (zig)
    _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                             ^
/home/david/dev/zig/src/Sema.zig:7516:33: 0x4fbf351 in analyzeCall (zig)
                sema.analyzeBody(&child_block, fn_info.body) catch |err| switch (err) {
                                ^
/home/david/dev/zig/src/Sema.zig:6735:43: 0x4a320f4 in zirCall__anon_158758 (zig)
    const call_inst = try sema.analyzeCall(block, func, func_ty, callee_src, call_src, modifier, ensure_result_used, args_info, call_dbg_node, .call);
                                          ^
/home/david/dev/zig/src/Sema.zig:1029:62: 0x46d9750 in analyzeBodyInner (zig)
            .call                         => try sema.zirCall(block, inst, .direct),
                                                             ^
/home/david/dev/zig/src/Sema.zig:5897:34: 0x507296b in resolveBlockBody (zig)
        if (sema.analyzeBodyInner(child_block, body)) |_| {
                                 ^
/home/david/dev/zig/src/Sema.zig:5880:33: 0x4afd0b4 in zirBlock (zig)
    return sema.resolveBlockBody(parent_block, src, &child_block, body, inst, &label.merges);
                                ^
/home/david/dev/zig/src/Sema.zig:1578:49: 0x46ea4ef in analyzeBodyInner (zig)
                    break :blk try sema.zirBlock(block, inst, tags[inst] == .block_comptime);
                                                ^
/home/david/dev/zig/src/Sema.zig:917:30: 0x49cdbf8 in analyzeBody (zig)
    _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                             ^
/home/david/dev/zig/src/Sema.zig:7516:33: 0x4fbf351 in analyzeCall (zig)
                sema.analyzeBody(&child_block, fn_info.body) catch |err| switch (err) {
                                ^
/home/david/dev/zig/src/Sema.zig:24005:28: 0x4a95149 in zirBuiltinCall (zig)
    return sema.analyzeCall(
                           ^
/home/david/dev/zig/src/Sema.zig:1147:69: 0x46deeae in analyzeBodyInner (zig)
            .builtin_call                 => try sema.zirBuiltinCall(block, inst),
                                                                    ^
/home/david/dev/zig/src/Sema.zig:934:45: 0x4457271 in analyzeBodyBreak (zig)
    const break_inst = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                                            ^
/home/david/dev/zig/src/Sema.zig:883:50: 0x4fb5ee3 in resolveBody (zig)
    const break_data = (try sema.analyzeBodyBreak(block, body)) orelse
                                                 ^
/home/david/dev/zig/src/Sema.zig:7024:59: 0x54bde75 in analyzeArg (zig)
                const uncoerced_arg = try sema.resolveBody(block, arg_body, zir_call.call_inst);
                                                          ^
/home/david/dev/zig/src/Sema.zig:7580:49: 0x4fc03e1 in analyzeCall (zig)
            arg_out.* = try args_info.analyzeArg(sema, block, arg_idx, param_ty, func_ty_info, func);
                                                ^
/home/david/dev/zig/src/Sema.zig:6735:43: 0x4a33348 in zirCall__anon_158759 (zig)
    const call_inst = try sema.analyzeCall(block, func, func_ty, callee_src, call_src, modifier, ensure_result_used, args_info, call_dbg_node, .call);
                                          ^
/home/david/dev/zig/src/Sema.zig:1030:62: 0x46d980c in analyzeBodyInner (zig)
            .field_call                   => try sema.zirCall(block, inst, .field),
                                                             ^
/home/david/dev/zig/src/Sema.zig:5897:34: 0x507296b in resolveBlockBody (zig)
        if (sema.analyzeBodyInner(child_block, body)) |_| {
                                 ^
/home/david/dev/zig/src/Sema.zig:5880:33: 0x4afd0b4 in zirBlock (zig)
    return sema.resolveBlockBody(parent_block, src, &child_block, body, inst, &label.merges);
                                ^
/home/david/dev/zig/src/Sema.zig:1578:49: 0x46ea4ef in analyzeBodyInner (zig)
                    break :blk try sema.zirBlock(block, inst, tags[inst] == .block_comptime);
                                                ^
/home/david/dev/zig/src/Sema.zig:917:30: 0x49cdbf8 in analyzeBody (zig)
    _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                             ^
/home/david/dev/zig/src/Module.zig:4825:21: 0x46b7466 in analyzeFnBody (zig)
    sema.analyzeBody(&inner_block, fn_info.body) catch |err| switch (err) {
                    ^
/home/david/dev/zig/src/Module.zig:3401:40: 0x44385cd in ensureFuncBodyAnalyzed (zig)
            var air = mod.analyzeFnBody(func_index, sema_arena) catch |err| switch (err) {
                                       ^
/home/david/dev/zig/src/Compilation.zig:3516:42: 0x443663d in processOneJob (zig)
            module.ensureFuncBodyAnalyzed(func) catch |err| switch (err) {
                                         ^
/home/david/dev/zig/src/Compilation.zig:3453:30: 0x421d25b in performAllTheWork (zig)
            try processOneJob(comp, work_item, main_progress_node);
                             ^
/home/david/dev/zig/src/Compilation.zig:2230:31: 0x42187ec in update (zig)
    try comp.performAllTheWork(main_progress_node);
                              ^
/home/david/dev/zig/src/main.zig:4234:24: 0x4248202 in updateModule (zig)
        try comp.update(main_progress_node);
                       ^
/home/david/dev/zig/src/main.zig:3637:17: 0x426a702 in buildOutputType (zig)
    updateModule(comp) catch |err| switch (err) {
                ^
/home/david/dev/zig/src/main.zig:271:31: 0x407d0df in mainArgs (zig)
        return buildOutputType(gpa, arena, args, .{ .build = .Exe });
                              ^
/home/david/dev/zig/src/main.zig:215:20: 0x407a3c5 in main (zig)
    return mainArgs(gpa, arena, args);
                   ^
/home/david/dev/zig/lib/std/start.zig:583:37: 0x4079dde in main (zig)
            const result = root.main() catch |err| {
                                    ^
../sysdeps/nptl/libc_start_call_main.h:58:16: 0x7fb3f673f1c9 in __libc_start_call_main (../sysdeps/x86/libc-start.c)
../csu/libc-start.c:360:3: 0x7fb3f673f284 in __libc_start_main_impl (../sysdeps/x86/libc-start.c)
???:?:?: 0x40799e0 in ??? (???)
???:?:?: 0x0 in ??? (???)
zsh: IOT instruction (core dumped)  /home/david/dev/zig/build-debug/stage3/bin/zig build-exe -fno-llvm -fno-lld

Expected Behavior

Compilation gone successful

@david4r4 david4r4 added the bug Observed behavior contradicts documented or intended behavior label Oct 19, 2023
@kubkon kubkon added this to the 0.13.0 milestone Oct 19, 2023
@andrewrk
Copy link
Member

Feel free to leave this open, but it's a tad bit early for such issues. Suggest to keep an eye on these instead:

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-self-hosted bug Observed behavior contradicts documented or intended behavior
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants