Skip to content

rustc segfaults on small program using rayon #83960

Open
@larswirzenius

Description

@larswirzenius

Code

The attached tarball has two versions of my program, reduced as much as I can. In the build subdirectory the program works fine. In fails building it causes a segfault. In both, build command was cargo build. This is entirely reproducible for me.

rustc-bug.tar.gz

Meta

rustc --version --verbose:

rustc 1.51.0 (2fd73fabe 2021-03-23)
binary: rustc
commit-hash: 2fd73fabe469357a12c2c974c140f67e7cdd76d0
commit-date: 2021-03-23
host: x86_64-unknown-linux-gnu
release: 1.51.0
LLVM version: 11.0.1

Error output

10:25 exolobe1:~/tmp/rustc-bug $ cd builds/
10:25 exolobe1:~/.../builds $ cargo build -q
10:25 exolobe1:~/.../builds $ cd ../fails/
10:26 exolobe1:~/.../fails $ cargo build -q
warning: field is never read: `data`
  --> src/main.rs:24:5
   |
24 |     data: [u8; SIZE],
   |     ^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

error: could not compile `checksum-concurrency`

Caused by:
  process didn't exit successfully: `rustc --crate-name checksum_concurrency --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=bb6d00e4307bf22c -C extra-filename=-bb6d00e4307bf22c --out-dir /home/liw/tmp/rustc-bug/fails/target/debug/deps -C incremental=/home/liw/tmp/rustc-bug/fails/target/debug/incremental -L dependency=/home/liw/tmp/rustc-bug/fails/target/debug/deps --extern rayon=/home/liw/tmp/rustc-bug/fails/target/debug/deps/librayon-875aabede64e7eb2.rlib --extern sha2=/home/liw/tmp/rustc-bug/fails/target/debug/deps/libsha2-eb3b7d824c3f1ca0.rlib` (signal: 11, SIGSEGV: invalid memory reference)
[PREVIOUS COMMAND EXIT: 101]
10:48 exolobe1:~/.../fails $ 
Backtrace

``` No backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions