Skip to content

LLVM assertion failed when attempting to install cargo-criterion #98076

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
saethlin opened this issue Jun 13, 2022 · 8 comments
Closed

LLVM assertion failed when attempting to install cargo-criterion #98076

saethlin opened this issue Jun 13, 2022 · 8 comments
Assignees
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug.

Comments

@saethlin
Copy link
Member

I install all my utilities in a bit of a unique setup with the goal of finding bugs. Perhaps like this one. I pull the latest rust commit, set

[llvm]
assertions = true

And run x build, with a custom toolchain set up called master-stage1 to the stage1 artifacts. Then I install utilities with this:

RUSTFLAGS="-Ccodegen-units=1 -Cforce-frame-pointers=yes -Cembed-bitcode=yes -Clto=fat -Cpanic=abort" cargo +master-stage1 install --target=x86_64-unknown-linux-gnu

A long list of binary crates follows. But currently, cargo-criterion does not build. I see this error:

   Compiling cargo-criterion v1.1.0
rustc: /checkout/src/llvm-project/llvm/lib/Analysis/InstructionPrecedenceTracking.cpp:99: void llvm::InstructionPrecedenceTracking::validate(const llvm::BasicBlock *) const: Assertion `It->second == nullptr && "Block is marked as having special instructions but in fact it  has " "none!"' failed.
error: could not compile `cargo-criterion`

Caused by:
  process didn't exit successfully: `rustc --crate-name cargo_criterion --edition=2018 /home/ben/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-criterion-1.1.0/src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="criterion-plot"' --cfg 'feature="default"' --cfg 'feature="gnuplot_backend"' --cfg 'feature="plotters"' --cfg 'feature="plotters_backend"' -C metadata=841c971ccd0a44a3 -C extra-filename=-841c971ccd0a44a3 --out-dir /tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps -L dependency=/tmp/cargo-installoHM8Uc/release/deps --extern anyhow=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/libanyhow-335a02709795f7b3.rlib --extern atty=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/libatty-e9a1e5205ef9284d.rlib --extern cast=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/libcast-34b92d6be5760477.rlib --extern chrono=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/libchrono-b483049206357f3a.rlib --extern clap=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/libclap-c9cdd34a3f4c6d02.rlib --extern criterion_plot=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/libcriterion_plot-00640a548f2ff1ec.rlib --extern lazy_static=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/liblazy_static-c62a2588d1d86244.rlib --extern linked_hash_map=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/liblinked_hash_map-75eeecf61eb4b9da.rlib --extern linked_hash_set=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/liblinked_hash_set-c9e7cbacc23d6223.rlib --extern log=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/liblog-6e3df9f143c1cedb.rlib --extern num_traits=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/libnum_traits-2a41da9f08d9fba1.rlib --extern oorandom=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/liboorandom-eded64dc41f41e73.rlib --extern plotters=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/libplotters-ead05f4c4043b836.rlib --extern rayon=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/librayon-89e2e2f93bae27d8.rlib --extern serde=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/libserde-741824d90db71d25.rlib --extern serde_cbor=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/libserde_cbor-3f1d61b2ede8f0c7.rlib --extern serde_derive=/tmp/cargo-installoHM8Uc/release/deps/libserde_derive-e7cd7a8d6adf4e7d.so --extern serde_json=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/libserde_json-01455dc3926f0c27.rlib --extern simplelog=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/libsimplelog-c293988276fa4483.rlib --extern tinytemplate=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/libtinytemplate-47711e5eabc0b1d6.rlib --extern toml=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/libtoml-2974066f02f64691.rlib --extern walkdir=/tmp/cargo-installoHM8Uc/x86_64-unknown-linux-gnu/release/deps/libwalkdir-4bd511db30d7d618.rlib --cap-lints allow -Ccodegen-units=1 -Cforce-frame-pointers=yes -Cembed-bitcode=yes -Clto=fat -Cpanic=abort` (signal: 6, SIGABRT: process abort signal)
error: failed to compile `cargo-criterion v1.1.0`, intermediate artifacts can be found at `/tmp/cargo-installoHM8Uc`

I would attach the intermediate artifacts, but as a .tar.gz they exceed the GitHub file size limit, and GitHub is rejecting my attempt to upload a .tar.xz. Do let me know if there is some file in particular that would be helpful.

@saethlin saethlin added the C-bug Category: This is a bug. label Jun 13, 2022
@saethlin
Copy link
Member Author

@rustbot labels +A-llvm

@rustbot rustbot added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Jun 13, 2022
@nikic
Copy link
Contributor

nikic commented Jun 14, 2022

I would attach the intermediate artifacts, but as a .tar.gz they exceed the GitHub file size limit, and GitHub is rejecting my attempt to upload a .tar.xz. Do let me know if there is some file in particular that would be helpful.

Can you please run cargo under -v, take the last rustc command and rerun it with -C save-temps and attach the .bc files that produces (maybe with a different output directory to separate them)?

@saethlin
Copy link
Member Author

with a different output directory

Do you mean CARGO_TARGET_DIR?

@saethlin
Copy link
Member Author

Oh you must mean --out-dir 🤦

cargo-criterion-assertion.tar.gz

@nikic
Copy link
Contributor

nikic commented Jun 15, 2022

Thanks, I can reproduce an assertion failure under lto<O3>, though it's a different one:

opt: /home/npopov/repos/llvm-project/llvm/lib/Analysis/AliasSetTracker.cpp:236: bool llvm::AliasSet::aliasesUnknownInst(const llvm::Instruction*, llvm::AliasAnalysis&) const: Assertion `Inst->mayReadOrWriteMemory() && "Instruction must either read or write memory."' failed.

This is likely llvm/llvm-project#51333.

@nikic nikic self-assigned this Jun 20, 2022
@nikic
Copy link
Contributor

nikic commented Jul 1, 2022

Upstream fix: llvm/llvm-project@560e694

@nikic
Copy link
Contributor

nikic commented Aug 30, 2022

Could you please check whether this issue has been resolved? The LLVM fix and update landed a while ago already.

@saethlin
Copy link
Member Author

Oops, thanks for reminder. Yes I can confirm that my example no longer reproduces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants