The package for tokio v1.29.1 failed to build during the F39 mass rebuild with Rust 1.71 on s390x only, with a consistent and reproducible crash of rustc with SIGILL that happens when compiling the "time_rt" tests: """ error: could not compile `tokio` (test "time_rt") Caused by: process didn't exit successfully: `/usr/bin/rustc --crate-name time_rt --edition=2021 tests/time_rt.rs (... compiler flags ellipsized here) (signal: 4, SIGILL: illegal instruction) """ koji task: https://koji.fedoraproject.org/koji/taskinfo?taskID=103766095 Reproducible: Always Steps to Reproduce: 1. fedpkg clone rust-tokio 2. cd rust-tokio 3. fedpkg build --scratch Actual Results: Rust compiler crashes on s390x. Expected Results: Package builds successfully on all architectures. The initial build of tokio v1.29.1 for rawhide was successful (two weeks before this failed build) with Rust 1.70.0: https://koji.fedoraproject.org/koji/buildinfo?buildID=2229054
I can reproduce this with rust-1.71.0-1.fc39, rust-1.70.0-1.fc39, and rust-1.69.0-3.fc39, but rust-1.69.0-2.fc39 passes. The big difference there is that -2 used LLVM 15, so it seems that all LLVM 16 builds have a problem. GDB doesn't make much sense of it: Thread 6 "opt time_rt.92c" received signal SIGTRAP, Trace/breakpoint trap. [Switching to Thread 0x3ffd83218c0 (LWP 17420)] 0x000003ffe8dbb728 in ?? () from /lib64/libLLVM-16.so (gdb) bt #0 0x000003ffe8dbb728 in ?? () from /lib64/libLLVM-16.so #1 0x000003ffeb37750c in computeKnownBits (V=0x3ffe0bc35b8, DemandedElts=..., Known=..., Depth=<optimized out>, Q=...) at /usr/src/debug/llvm-16.0.6-4.fc39.s390x/lib/Analysis/ValueTracking.cpp:2046 #2 0x0000000000000050 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?)
I can also reproduce a crash with upstream Rust builds, and the upstream tokio git. It compiles with 1.69.0 (bundled llvm 15.0.7) and crashes with 1.70.0 (bundled llvm 16.0.2), but this time with SIGFPE. https://github.com/tokio-rs/tokio/tree/a58beb3aca18e6ec4cb444b6c78d5a3373742998/tokio $ RUSTFLAGS=-Ccodegen-units=1 cargo +1.70.0 build --release --test time_rt --all-features ... error: could not compile `tokio` (test "time_rt") Caused by: process didn't exit successfully: `rustc --crate-name time_rt --edition=2021 tokio/tests/time_rt.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=251 --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no --test --cfg 'feature="bytes"' --cfg 'feature="default"' --cfg 'feature="fs"' --cfg 'feature="full"' --cfg 'feature="io-std"' --cfg 'feature="io-util"' --cfg 'feature="libc"' --cfg 'feature="macros"' --cfg 'feature="mio"' --cfg 'feature="net"' --cfg 'feature="num_cpus"' --cfg 'feature="parking_lot"' --cfg 'feature="process"' --cfg 'feature="rt"' --cfg 'feature="rt-multi-thread"' --cfg 'feature="signal"' --cfg 'feature="signal-hook-registry"' --cfg 'feature="socket2"' --cfg 'feature="stats"' --cfg 'feature="sync"' --cfg 'feature="test-util"' --cfg 'feature="time"' --cfg 'feature="tokio-macros"' --cfg 'feature="tracing"' --cfg 'feature="windows-sys"' -C metadata=51c6600cbd7ec5c9 -C extra-filename=-51c6600cbd7ec5c9 --out-dir /root/tokio/target/release/deps -L dependency=/root/tokio/target/release/deps --extern async_stream=/root/tokio/target/release/deps/libasync_stream-0e1b47935e32e7db.rlib --extern bytes=/root/tokio/target/release/deps/libbytes-3bb1190b0cd2f392.rlib --extern futures=/root/tokio/target/release/deps/libfutures-aad19d8da72d3480.rlib --extern libc=/root/tokio/target/release/deps/liblibc-c0d20eccffc30c7c.rlib --extern mio=/root/tokio/target/release/deps/libmio-6e8b7fbee28df1d4.rlib --extern mockall=/root/tokio/target/release/deps/libmockall-ec54ec4ddca53892.rlib --extern nix=/root/tokio/target/release/deps/libnix-feb01785fb6919ee.rlib --extern num_cpus=/root/tokio/target/release/deps/libnum_cpus-ba7c2eeb3593e7d6.rlib --extern parking_lot=/root/tokio/target/release/deps/libparking_lot-4cfc0e3490b8ec10.rlib --extern pin_project_lite=/root/tokio/target/release/deps/libpin_project_lite-b655cdd536450e96.rlib --extern rand=/root/tokio/target/release/deps/librand-4a990bec2965395e.rlib --extern signal_hook_registry=/root/tokio/target/release/deps/libsignal_hook_registry-2bd0f6f22d781c8e.rlib --extern socket2=/root/tokio/target/release/deps/libsocket2-66a65b247261e899.rlib --extern tempfile=/root/tokio/target/release/deps/libtempfile-2ea631b395d5a10d.rlib --extern tokio=/root/tokio/target/release/deps/libtokio-a0091aabb9e0907e.rlib --extern tokio_macros=/root/tokio/target/release/deps/libtokio_macros-5709263f84331fbd.so --extern tokio_stream=/root/tokio/target/release/deps/libtokio_stream-e78a6ae35cbe7a71.rlib --extern tokio_test=/root/tokio/target/release/deps/libtokio_test-3627ae0030cdfd35.rlib -Ccodegen-units=1` (signal: 8, SIGFPE: erroneous arithmetic operation) #0 0x000003ffeec97152 in llvm::MVT::getVT(llvm::Type*, bool) [clone .localalias.70] () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so [0/1855] #1 0x000003ffeec97d7e in llvm::EVT::getEVT(llvm::Type*, bool) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #2 0x000003ffedb25472 in llvm::TargetLoweringBase::getValueType(llvm::DataLayout const&, llvm::Type*, bool) const () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #3 0x000003ffedbf2c10 in llvm::SystemZTTIImpl::getUnrollingPreferences(llvm::Loop*, llvm::ScalarEvolution&, llvm::TargetTransformInfo::UnrollingPreferences&, llvm::OptimizationRemarkEmitter*) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #4 0x000003ffedbe64b6 in llvm::TargetTransformInfo::Model<llvm::SystemZTTIImpl>::getUnrollingPreferences(llvm::Loop*, llvm::ScalarEvolution&, llvm::TargetTransformInfo::UnrollingPreferences&, llvm::OptimizationRemarkEmitter*) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #5 0x000003ffef677b90 in llvm::TargetTransformInfo::getUnrollingPreferences(llvm::Loop*, llvm::ScalarEvolution&, llvm::TargetTransformInfo::UnrollingPreferences&, llvm::OptimizationRemarkEmitter*) const () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #6 0x000003ffeeeb11fa in llvm::gatherUnrollingPreferences(llvm::Loop*, llvm::ScalarEvolution&, llvm::TargetTransformInfo const&, llvm::BlockFrequencyInfo*, llvm::ProfileSummaryInfo*, llvm::OptimizationRemarkEmitter&, int, std::optional<unsigned int>, std::optional<unsigned int>, std::optional<bool>, std::optional<bool>, std::optional<bool>, std::optional<unsigned int>) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #7 0x000003ffeeeb7088 in tryToUnrollLoop(llvm::Loop*, llvm::DominatorTree&, llvm::LoopInfo*, llvm::ScalarEvolution&, llvm::TargetTransformInfo const&, llvm::AssumptionCache&, llvm::OptimizationRemarkEmitter&, llvm::BlockFrequencyInfo*, llvm::ProfileSummaryInfo*, bool, int, bool, bool, std::optional<unsigned int>, std::optional<unsigned int>, std::optional<bool>, std::optional<bool>, std::optional<bool>, std::optional<bool>, std::optional<bool>, std::optional<unsigned int>) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #8 0x000003ffeeeb835a in llvm::LoopFullUnrollPass::run(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #9 0x000003ffede25f0e in llvm::detail::PassModel<llvm::Loop, llvm::LoopFullUnrollPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::run(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #10 0x000003ffeee632bc in llvm::PassManager<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::runWithoutLoopNestPasses(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #11 0x000003ffeee61d80 in llvm::PassManager<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::run(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #12 0x000003ffeee65110 in llvm::FunctionToLoopPassAdaptor::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #13 0x000003ffede23ea2 in llvm::detail::PassModel<llvm::Function, llvm::FunctionToLoopPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #14 0x000003ffedd2bbe4 in llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #15 0x000003ffef3ea0b8 in llvm::CGSCCToFunctionPassAdaptor::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #16 0x000003ffede23e76 in llvm::detail::PassModel<llvm::LazyCallGraph::SCC, llvm::CGSCCToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #17 0x000003ffef3e35a0 in llvm::PassManager<llvm::LazyCallGraph::SCC, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #18 0x000003ffede23e06 in llvm::detail::PassModel<llvm::LazyCallGraph::SCC, llvm::PassManager<llvm::LazyCallGraph::SCC, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCall Graph&, llvm::CGSCCUpdateResult&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #19 0x000003ffef3e6c28 in llvm::DevirtSCCRepeatedPass::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #20 0x000003ffede23e3e in llvm::detail::PassModel<llvm::LazyCallGraph::SCC, llvm::DevirtSCCRepeatedPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #21 0x000003ffef3e5094 in llvm::ModuleToPostOrderCGSCCPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #22 0x000003ffede23dca in llvm::detail::PassModel<llvm::Module, llvm::ModuleToPostOrderCGSCCPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #23 0x000003ffefa788f2 in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #24 0x000003ffee2035d2 in llvm::ModuleInlinerWrapperPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #25 0x000003ffede236aa in llvm::detail::PassModel<llvm::Module, llvm::ModuleInlinerWrapperPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #26 0x000003ffefa788f2 in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #27 0x000003ffedad98ae in LLVMRustOptimize () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so #28 0x000003ffedab7460 in rustc_codegen_llvm[9e81a53351863c9d]::back::write::llvm_optimize () from /root/.rustup/toolchains/1.70.0-s390x-unknown-linux-gnu/bin/../lib/librustc_driver-b1d432d6f4de30ea.so
Created attachment 1977400 [details] LLVM bytecode reproducer Crashes "opt -disable-output -O3", both on a native s390x host and cross from x86_64. It does not crash with -O2.
Interestingly, I can reproduce this issue only on rawhide. It works well on F38.
As my previous comment implies: this bug doesn't seem to affect LLVM 16.0 upstream. I was able to bisect the issue started with llvm-16.0.6-4 on Rawhide. I was able to reproduce this issue with llvm-16.0.6-1.el9.s390x on CentOS Stream 9 development.
Created attachment 1980167 [details] reduced.bc llvm-reduce gave me this test, which crashes even with -O1.
The fix for this issue in Rawhide is available in https://bodhi.fedoraproject.org/updates/FEDORA-2023-bfdc5ae454
Can confirm that this is fixed in rawhide, a new build of tokio succeeded. Thanks! I'm not sure why this doesn't seem to affect f38 ... it's on llvm 16.0.6 as well.
> I'm not sure why this doesn't seem to affect f38 ... it's on llvm 16.0.6 as well. It's because rawhide has an extra change, "Disable LLVM_UNREACHABLE_OPTIMIZE" -- when off, it turns its llvm_unreachable macro into a trap, which is the crash we see here. So I expect f38 *is* hitting this bad code path, but falls through in a UB sort of way that happens to "work" ok.
FEDORA-2023-574bb8808b has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-574bb8808b
FEDORA-2023-574bb8808b has been pushed to the Fedora 38 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-574bb8808b` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-574bb8808b See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2023-574bb8808b has been pushed to the Fedora 38 stable repository. If problem still persists, please make note of it in this bug report.