Skip to content

compilation failed with segment fault #17938

@tw4452852

Description

@tw4452852

Zig Version

0.12.0-dev.1496+bf0387b6bb

Steps to Reproduce and Observed Behavior

Here's the log:

zig build-exe trace Debug native: error: thread 17805 panic: reached unreachable code
Analyzing /home/tw/code/zig/stage3/lib/zig/std/mem.zig: mem.zig:zeroes
      %1086 = dbg_block_begin()
      %1087 = dbg_stmt(2, 5)
      %1088 = block_comptime({
        %1089 = break(%1088, %1084)
      })
    > %1090 = type_info(%1088)
      %1091 = dbg_stmt(2, 13)
...
/home/tw/code/zig/lib/std/debug.zig:342:14: 0x8d5bd1c in assert (zig)
    if (!ok) unreachable; // assertion failure
             ^
/home/tw/code/zig/src/InternPool.zig:2053:15: 0x8ecd983 in toType (zig)
        assert(i != .none);
              ^
/home/tw/code/zig/src/Sema.zig:34679:67: 0x93e67e5 in resolveStructLayout (zig)
        const field_ty = struct_type.field_types.get(ip)[i].toType();
                                                                  ^
/home/tw/code/zig/src/Sema.zig:34553:51: 0x9148cb3 in resolveTypeLayout (zig)
        .Struct => return sema.resolveStructLayout(ty),
                                                  ^
/home/tw/code/zig/src/Sema.zig:17567:39: 0x976add3 in zirTypeInfo (zig)
            try sema.resolveTypeLayout(ty); // Getting alignment requires type layout
                                      ^
/home/tw/code/zig/src/Sema.zig:1096:66: 0x93d743b in analyzeBodyInner (zig)
            .type_info                    => try sema.zirTypeInfo(block, inst),
                                                                 ^
/home/tw/code/zig/src/Sema.zig:933:45: 0x914fae1 in analyzeBodyBreak (zig)
    const break_inst = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                                            ^
/home/tw/code/zig/src/Sema.zig:1589:62: 0x93e4c31 in analyzeBodyInner (zig)
                const break_data = (try sema.analyzeBodyBreak(block, inline_body)) orelse
                                                             ^
/home/tw/code/zig/src/Sema.zig:916:30: 0x96c6198 in analyzeBody (zig)
    _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
...

This happen when I compile zbpf project with: zig build trace -Dkprobe=vfs_read

Expected Behavior

Build sucessfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions