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

segfault when testing a second copy of the std lib #12684

Open
andrewrk opened this issue Aug 30, 2022 · 0 comments
Open

segfault when testing a second copy of the std lib #12684

andrewrk opened this issue Aug 30, 2022 · 0 comments
Labels
bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone

Comments

@andrewrk
Copy link
Member

Steps to reproduce:

  1. Build zig from source without using -Dskip-install-lib-files. There are now 2 copies of lib/, one in the source tree, and one in zig-out/lib.
  2. Run std lib tests on the source tree lib/ without passing --zig-lib-dir.
$ stage3/bin/zig test ../lib/std/std.zig -femit-docs=$(pwd)/blah -fno-emit-bin
Semantic Analysis [1537] openZ... Segmentation fault at address 0x4b
/home/andy/dev/zig/lib/std/hash_map.zig:1231:13: 0x764ac15 in getPtr (zig)
            }
            ^
/home/andy/dev/zig/src/Sema.zig:13654:34: 0x738b137 in zirClosureGet (zig)
        if (scope.captures.getPtr(inst_data.inst)) |tv| {
                                 ^
/home/andy/dev/zig/src/Sema.zig:725:68: 0x71bb839 in analyzeBodyInner (zig)
            .closure_get                  => try sema.zirClosureGet(block, inst),
                                                                   ^
/home/andy/dev/zig/src/Sema.zig:609:30: 0x71b9da8 in analyzeBody (zig)
    _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                             ^
/home/andy/dev/zig/src/Sema.zig:6038:33: 0x7648522 in analyzeCall (zig)
                sema.analyzeBody(&child_block, fn_info.body) catch |err| switch (err) {
                                ^
/home/andy/dev/zig/src/Sema.zig:5574:28: 0x738af05 in zirCall (zig)
    return sema.analyzeCall(block, func, func_src, call_src, modifier, ensure_result_used, resolved_args, bound_arg_src);
                           ^
/home/andy/dev/zig/src/Sema.zig:724:62: 0x71bb75b in analyzeBodyInner (zig)
            .call                         => try sema.zirCall(block, inst),
                                                             ^
/home/andy/dev/zig/src/Sema.zig:626:45: 0x7036778 in analyzeBodyBreak (zig)
    const break_inst = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                                            ^
/home/andy/dev/zig/src/Sema.zig:1252:62: 0x71cac38 in analyzeBodyInner (zig)
                const break_data = (try sema.analyzeBodyBreak(block, inline_body)) orelse
                                                             ^
/home/andy/dev/zig/src/Sema.zig:609:30: 0x71b9da8 in analyzeBody (zig)
    _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                             ^
/home/andy/dev/zig/src/Sema.zig:6038:33: 0x7648522 in analyzeCall (zig)
                sema.analyzeBody(&child_block, fn_info.body) catch |err| switch (err) {
                                ^
/home/andy/dev/zig/src/Sema.zig:5574:28: 0x738af05 in zirCall (zig)
    return sema.analyzeCall(block, func, func_src, call_src, modifier, ensure_result_used, resolved_args, bound_arg_src);
                           ^
/home/andy/dev/zig/src/Sema.zig:724:62: 0x71bb75b in analyzeBodyInner (zig)
            .call                         => try sema.zirCall(block, inst),
                                                             ^
/home/andy/dev/zig/src/Sema.zig:626:45: 0x7036778 in analyzeBodyBreak (zig)
    const break_inst = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                                            ^
/home/andy/dev/zig/src/Sema.zig:1252:62: 0x71cac38 in analyzeBodyInner (zig)
                const break_data = (try sema.analyzeBodyBreak(block, inline_body)) orelse
                                                             ^
/home/andy/dev/zig/src/Sema.zig:609:30: 0x71b9da8 in analyzeBody (zig)
    _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                             ^
/home/andy/dev/zig/src/Sema.zig:6038:33: 0x7648522 in analyzeCall (zig)
                sema.analyzeBody(&child_block, fn_info.body) catch |err| switch (err) {
                                ^
/home/andy/dev/zig/src/Sema.zig:5574:28: 0x738af05 in zirCall (zig)
    return sema.analyzeCall(block, func, func_src, call_src, modifier, ensure_result_used, resolved_args, bound_arg_src);
                           ^
/home/andy/dev/zig/src/Sema.zig:724:62: 0x71bb75b in analyzeBodyInner (zig)
            .call                         => try sema.zirCall(block, inst),
                                                             ^
/home/andy/dev/zig/src/Sema.zig:626:45: 0x7036778 in analyzeBodyBreak (zig)
    const break_inst = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                                            ^
/home/andy/dev/zig/src/Sema.zig:591:50: 0x7642575 in resolveBody (zig)
    const break_data = (try sema.analyzeBodyBreak(block, body)) orelse
                                                 ^
/home/andy/dev/zig/src/Sema.zig:7605:42: 0x7655abf in resolveGenericBody (zig)
        const uncasted = sema.resolveBody(block, body, func_inst) catch |err| break :err err;
                                         ^
/home/andy/dev/zig/src/Sema.zig:7544:59: 0x7394fa7 in zirFunc (zig)
            const ret_ty_val = try sema.resolveGenericBody(block, ret_ty_src, ret_ty_body, inst, Type.type, "return type must be comptime known");
                                                          ^
/home/andy/dev/zig/src/Sema.zig:759:62: 0x71bd650 in analyzeBodyInner (zig)
            .func                         => try sema.zirFunc(block, inst, false),
                                                             ^
/home/andy/dev/zig/src/Sema.zig:626:45: 0x7036778 in analyzeBodyBreak (zig)
    const break_inst = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                                            ^
/home/andy/dev/zig/src/Sema.zig:591:50: 0x7642575 in resolveBody (zig)
    const break_data = (try sema.analyzeBodyBreak(block, body)) orelse
                                                 ^
/home/andy/dev/zig/src/Sema.zig:6565:53: 0x7831137 in instantiateGenericCall (zig)
        const new_func_inst = child_sema.resolveBody(&child_block, fn_info.param_body, fn_info.param_body_inst) catch |err| {
                                                    ^
/home/andy/dev/zig/src/Sema.zig:5783:40: 0x7644914 in analyzeCall (zig)
        if (sema.instantiateGenericCall(
                                       ^
/home/andy/dev/zig/src/Sema.zig:5574:28: 0x738af05 in zirCall (zig)
    return sema.analyzeCall(block, func, func_src, call_src, modifier, ensure_result_used, resolved_args, bound_arg_src);
                           ^
/home/andy/dev/zig/src/Sema.zig:724:62: 0x71bb75b in analyzeBodyInner (zig)
            .call                         => try sema.zirCall(block, inst),
                                                             ^
/home/andy/dev/zig/src/Sema.zig:626:45: 0x7036778 in analyzeBodyBreak (zig)
    const break_inst = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                                            ^
/home/andy/dev/zig/src/Sema.zig:591:50: 0x7642575 in resolveBody (zig)
    const break_data = (try sema.analyzeBodyBreak(block, body)) orelse
                                                 ^
/home/andy/dev/zig/src/Sema.zig:5571:56: 0x738ad09 in zirCall (zig)
        resolved_args[arg_index] = try sema.resolveBody(block, args_body[arg_start..arg_end], inst);
                                                       ^
/home/andy/dev/zig/src/Sema.zig:724:62: 0x71bb75b in analyzeBodyInner (zig)
            .call                         => try sema.zirCall(block, inst),
                                                             ^
/home/andy/dev/zig/src/Sema.zig:609:30: 0x71b9da8 in analyzeBody (zig)
    _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                             ^
/home/andy/dev/zig/src/Module.zig:5534:21: 0x702344c in analyzeFnBody (zig)
    sema.analyzeBody(&inner_block, fn_info.body) catch |err| switch (err) {
                    ^
/home/andy/dev/zig/src/Module.zig:4245:40: 0x6e4b4a4 in ensureFuncBodyAnalyzed (zig)
            var air = mod.analyzeFnBody(func, sema_arena) catch |err| switch (err) {
                                       ^
/home/andy/dev/zig/src/Compilation.zig:2977:42: 0x6e49a12 in processOneJob (zig)
            module.ensureFuncBodyAnalyzed(func) catch |err| switch (err) {
                                         ^
/home/andy/dev/zig/src/Compilation.zig:2915:30: 0x6d5a6ba in performAllTheWork (zig)
            try processOneJob(comp, work_item);
                             ^
/home/andy/dev/zig/src/Compilation.zig:2255:31: 0x6d571cc in update (zig)
    try comp.performAllTheWork(main_progress_node);
                              ^
/home/andy/dev/zig/src/main.zig:3334:20: 0x6d81306 in updateModule (zig)
    try comp.update();
                   ^
/home/andy/dev/zig/src/main.zig:3008:17: 0x6b2b4b4 in buildOutputType (zig)
    updateModule(gpa, comp, hook) catch |err| switch (err) {
                ^
/home/andy/dev/zig/src/main.zig:236:31: 0x6ab189b in mainArgs (zig)
        return buildOutputType(gpa, arena, args, .zig_test);
                              ^
/home/andy/dev/zig/src/stage1.zig:48:24: 0x6ab0c62 in main (zig)
        stage2.mainArgs(gpa, arena, args) catch unreachable;
                       ^
Aborted (core dumped)
@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness. labels Aug 30, 2022
@andrewrk andrewrk added this to the 0.10.0 milestone Aug 30, 2022
andrewrk added a commit that referenced this issue Aug 30, 2022
@andrewrk andrewrk modified the milestones: 0.10.0, 0.10.1 Oct 12, 2022
@andrewrk andrewrk modified the milestones: 0.10.1, 0.11.0 Jan 10, 2023
@andrewrk andrewrk modified the milestones: 0.11.0, 0.11.1 Jul 20, 2023
@andrewrk andrewrk modified the milestones: 0.11.1, 0.12.0, 0.13.0 Jan 29, 2024
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

1 participant