Skip to content

New compiler: [Platform] std.Thread.spawn -> unreachable -> segfault #8566

@scottc

Description

@scottc

x86_64 linux

New roc compiler

Commit: 719fcae1151c0f1ecd30894366cbe4c9e2f99397

Adding a std.Thread.spawn call...

fn hostedStdoutLine(ops: *builtins.host_abi.RocOps, ret_ptr: *anyopaque, args_ptr: *anyopaque) callconv(.c) void {
    _ = ops;
    _ = ret_ptr;
    _ = args_ptr;

    // ...

    const thread_test = struct {
        fn worker() void {
            std.Thread.sleep(1 * std.time.ns_per_s);
        }
    };

    _ = std.Thread.spawn(.{}, thread_test.worker, .{}) catch {};

    // ...
}

Result: thread 54669 panic: reached unreachable code

[anon@nixos:~/Projects/roc]$ zig build test
[...tests fail...]

[anon@nixos:~/Projects/roc]$ ./zig-out/bin/roc ./test/fx/app.roc
thread 54669 panic: reached unreachable code
error: Child process /home/anon/.cache/roc/75fed07d9047282a9e6197f23853ba39/temp/roc-tmp-RmsPvqoZLOh3Y7e4JvbGzW1HSRiQC1uu/roc_run_3344319531 killed by signal: 11
error: Child process crashed with segmentation fault (SIGSEGV)

Then program exits, without continuing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions