Description
xref: https://bugzilla.redhat.com/show_bug.cgi?id=1883457
In the Fedora build of coreos-installer 0.7.0, one of the tests crashed with SIGSEGV
on s390x, while it passed on every other architecture. The reporter in Red Hat bugzilla found that it happens equally with system LLVM 11 or 10. The crate's Cargo.toml
also has lto = true
, but they didn't see any improvement after turning that off.
The distro builds run tests in release mode (to avoid recompiling from the main build) with flags in .cargo/config
:
[build]
rustc = "/usr/bin/rustc"
rustdoc = "/usr/bin/rustdoc"
rustflags = ["-Copt-level=3", "-Cdebuginfo=2", "-Clink-arg=-Wl,-z,relro,-z,now", "-Ccodegen-units=1", "--cap-lints=warn", ]
The tests pass if we don't set -Ccodegen-units=1
, which suggests to me that some relevant (mis)optimization is only triggered with the full unit.
The tests are also fine with Fedora's rust-1.45.2, only crashing on rust-1.46.0. I also reproduced the crash on rustup's stable 1.46.0, and I used cargo bisect-rustc
to narrow down to nightly-2020-07-05
passing, while nightly-2020-07-06
crashes. That's 0cd7ff7...2753fab, which is just #73879 (cc @ecstatic-morse). I don't know if codegen-units
would affect that, or if it's just triggering something new in LLVM.
Here's the reporter's backtrace:
#0 0x000002aa0c3616c4 in core::ptr::drop_in_place () at /builddir/build/BUILD/rustc-1.46.0-src/src/libcore/ptr/mod.rs:184
#1 core::ptr::drop_in_place () at /builddir/build/BUILD/rustc-1.46.0-src/src/libcore/ptr/mod.rs:184
#2 core::ptr::drop_in_place () at /builddir/build/BUILD/rustc-1.46.0-src/src/libcore/ptr/mod.rs:184
#3 core::ptr::drop_in_place () at /builddir/build/BUILD/rustc-1.46.0-src/src/libcore/ptr/mod.rs:184
#4 core::ptr::drop_in_place () at /builddir/build/BUILD/rustc-1.46.0-src/src/libcore/ptr/mod.rs:184
#5 <libcoreinst::source::FileLocation as libcoreinst::source::ImageLocation>::sources (self=0x3ffcc3fc4f8) at src/source.rs:135
#6 libcoreinst::download::tests::test_write_image_limit () at src/download.rs:489