Skip to content

compilation failed with segment fault #17938

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

Closed
tw4452852 opened this issue Nov 9, 2023 · 2 comments
Closed

compilation failed with segment fault #17938

tw4452852 opened this issue Nov 9, 2023 · 2 comments
Labels
bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone

Comments

@tw4452852
Copy link
Contributor

tw4452852 commented Nov 9, 2023

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.

@tw4452852 tw4452852 added the bug Observed behavior contradicts documented or intended behavior label Nov 9, 2023
@Vexu Vexu added the frontend Tokenization, parsing, AstGen, Sema, and Liveness. label Nov 9, 2023
@Vexu Vexu added this to the 0.13.0 milestone Nov 9, 2023
@ianprime0509
Copy link
Contributor

This looks like it should have been fixed by #17692, and I'm not getting this crash on 0.12.0-dev.1685+994e19164 (I get an unrelated compile error when running the provided command on commit 9d4d89011b6c51b3ea5359210d05c6def9fc5da9 of the project). Could you confirm if you're still experiencing this?

@tw4452852
Copy link
Contributor Author

@ianprime0509 Confirmed this issue has been fixed on the latest master. Thanks!

@Vexu Vexu modified the milestones: 0.13.0, 0.12.0 Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Projects
None yet
Development

No branches or pull requests

3 participants