-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 in llvm_gcda_start_file in a mixed C++/Rust program #76085
Comments
This works around rust-lang/rust#76085.
I also see this. I guess it's a result of LLVM version skew in the first instance, that rustc doesn't ship with the LLVM distribution it links against for use by end-users in the second instance, but the wider problem is that there is no tested, supported coverage tooling for Rust. This is a frustrating situation. |
Almost the same issue, with the same project, this time caused by Rust's upgrade to LLVM 12: searched nightlies: from nightly-2021-03-01 to nightly-2021-03-10 bisected with cargo-bisect-rustc v0.6.0Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc --start=2021-03-01 --script ./script.sh
#!/bin/sh
export CXX=clang++-11
export CC=clang-11
export PROFILE=1
export CARGO_INCREMENTAL=0
export RUSTFLAGS='-A warnings -Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort'
export RUSTDOCFLAGS='-Cpanic=abort'
export RUST_TEST_THREADS=2
export TMPDIR=/dev/shm/
make -j9 all test profclean
cd test
timeout 30 ./test '[this]' This time it segfaults all over the place: in Rust's stdlib, in gcov, or it just hangs waiting for something inside pthreads. Compiling C++ with Clang 12 works around the issue. Still can't provide a minimal reproducer because the causes for SIGSEGV are all different and seem to be intertwined with the test harness (Catch2). So building my project seems the only way to reproduce this :( |
This works around rust-lang/rust#76085.
Triage: Can you still reproduce this? |
My CI still uses Clang 12 and up-to-date Nightly, and I haven't seen that config fail since March 2021. So at least this doesn't happen every time rustc bumps its LLVM version. Would you like me to reproduce with Clang 8 and current Nightly? |
For my repro of this issue:
I think this was mostly ameliorated by rustup shipping llvm-tools (#85658).
I now use https://crates.io/crates/cargo-llvm-cov for this, which is a significantly improved experience over driving the llvm tools myself, and insulates me from worrying about LLVM version skew. |
Sorry for being unclear! I meant "can you reproduce with the latest versions of everything?". Sounds as if the answer is "no"? Then we close this issue I believe? |
Well, the original issue didn't happen when everything was at latest versions -- it only occurred when Clang was older than the LLVM used by rustc. But given that modern rustc doesn't seem to have any problems with (slightly old) Clang 12, I think this issue is no longer important and can indeed be closed. |
I have a program where C++ code calls into Rust code. To calculate test coverage, I compile the Rust part with a Nightly, and C++ part with Clang 8. I then run a C++ test suite. This worked fine until recently, but now segfaults. C++ test suite receives SIGSEGV while writing out the coverage info:
I observe this behaviour with Clang 8 and 9. With Clang 10, things are simply bizarre: the test suite reports numerous SIGSEGVs and then declares that all tests passed; I can't explain such behaviour. With Clang 11, the test suite passes without issue.
bisect-rustc narrowed this down to a recent upgrade to LLVM 11:
searched nightlies: from nightly-2020-08-23 to nightly-2020-08-29
regressed nightly: nightly-2020-08-24
searched commits: from 663d2f5 to 5180f3d
regressed commit: 7ce71c3
bisected with cargo-bisect-rustc v0.5.2
Host triple: x86_64-unknown-linux-gnu
Reproduce with:
The
evaluate.sh
is:The project in question can be cloned from https://github.com/newsboat/newsboat.git I failed to write a small reproducer: it appears that I do need the Catch2 test framework and a lot of other code to trigger this.
The text was updated successfully, but these errors were encountered: