rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.23k stars 12.7k forks source link

rustc SIGSEGV while compiling & running tests #124523

Open Spindel opened 6 months ago

Spindel commented 6 months ago

Funny case, getting sigsegv while compiling the tests, but even then I get a working test-suite and I have no idea why rustc is crashing here.

I've filed it as an ICE as it's techincally a compiler crashing, but I really do not know what to file this as.

Code

not applicable, the code runs, and the tests run afterwards as well, yet I got a crash in rustc..

Meta

rustc --version --verbose:

rustc 1.77.2 (25ef9e3d8 2024-04-09)
binary: rustc
commit-hash: 25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04
commit-date: 2024-04-09
host: x86_64-unknown-linux-gnu
release: 1.77.2
LLVM version: 17.0.6

Error output

spider@nerk:~/Projects/PROJECT_NAME$ cargo clippy
    Checking PROJECT_NAME v0.0.0 (/home/spider/Projects/PROJECT_NAME)
    Finished dev [unoptimized + debuginfo] target(s) in 3.47s
spider@nerk:~/Projects/PROJECT_NAME$ cargo test
   Compiling pin-project-lite v0.2.13
   Compiling futures-core v0.3.30
   Compiling cfg-if v1.0.0
   Compiling once_cell v1.19.0
   Compiling memchr v2.7.1
   Compiling log v0.4.20
   Compiling futures-io v0.3.30
   Compiling parking v2.2.0
   Compiling hashbrown v0.14.3
   Compiling pin-utils v0.1.0
   Compiling equivalent v1.0.1
   Compiling libc v0.2.152
   Compiling crossbeam-utils v0.8.19
   Compiling winnow v0.5.34
   Compiling serde v1.0.195
   Compiling slab v0.4.9
   Compiling futures-sink v0.3.30
   Compiling bitflags v1.3.2
   Compiling memoffset v0.7.1
   Compiling typenum v1.17.0
   Compiling futures-channel v0.3.30
   Compiling futures-task v0.3.30
   Compiling bytes v1.5.0
   Compiling fastrand v2.0.1
   Compiling tracing-core v0.1.32
   Compiling event-listener v2.5.3
   Compiling futures-lite v2.2.0
   Compiling byteorder v1.5.0
   Compiling atomic-waker v1.1.2
   Compiling fastrand v1.9.0
   Compiling async-task v4.7.0
   Compiling concurrent-queue v2.4.0
   Compiling waker-fn v1.1.1
   Compiling piper v0.2.1
   Compiling async-lock v2.8.0
   Compiling thiserror v1.0.56
   Compiling linux-raw-sys v0.3.8
   Compiling static_assertions v1.1.0
   Compiling event-listener v4.0.3
   Compiling tracing v0.1.40
   Compiling futures-util v0.3.30
   Compiling aho-corasick v1.1.2
   Compiling futures-lite v1.13.0
   Compiling ppv-lite86 v0.2.17
   Compiling indexmap v2.1.0
   Compiling unescaper v0.1.3
   Compiling event-listener-strategy v0.4.0
   Compiling generic-array v0.14.7
   Compiling bitflags v2.4.1
   Compiling async-lock v3.3.0
   Compiling async-channel v2.1.1
   Compiling scopeguard v1.2.0
   Compiling regex-syntax v0.6.29
   Compiling regex-syntax v0.8.2
   Compiling cpufeatures v0.2.12
   Compiling async-broadcast v0.5.1
   Compiling ordered-stream v0.2.0
   Compiling overload v0.1.1
   Compiling hex v0.4.3
   Compiling lazy_static v1.4.0
   Compiling smallvec v1.12.0
   Compiling sharded-slab v0.1.7
   Compiling nu-ansi-term v0.46.0
   Compiling tracing-log v0.2.0
   Compiling blocking v1.5.1
   Compiling mio v0.8.10
   Compiling socket2 v0.5.5
   Compiling signal-hook-registry v1.4.1
   Compiling nix v0.26.4
   Compiling getrandom v0.2.12
   Compiling crypto-common v0.1.6
   Compiling block-buffer v0.10.4
   Compiling io-lifetimes v1.0.11
   Compiling rand_core v0.6.4
   Compiling digest v0.10.7
   Compiling rustix v0.37.27
   Compiling socket2 v0.4.10
   Compiling tokio v1.35.1
   Compiling regex-automata v0.4.3
   Compiling rand_chacha v0.3.1
   Compiling polling v2.8.0
   Compiling toml_edit v0.19.15
   Compiling sha1 v0.10.6
   Compiling async-fs v1.6.0
   Compiling rand v0.8.5
   Compiling async-executor v1.8.0
   Compiling thread_local v1.1.7
error: rustc interrupted by SIGSEGV, printing backtrace

/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x2bbe886)[0x7faf955be886]
/lib64/libc.so.6(+0x3e9a0)[0x7faf985859a0]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm16SelectionDAGISel17CodeGenAndEmitDAGEv+0xe7f)[0x7faf90da53db]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm16SelectionDAGISel20SelectAllBasicBlocksERKNS_8FunctionE+0x16be)[0x7faf9142623e]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm16SelectionDAGISel20runOnMachineFunctionERNS_15MachineFunctionE+0x7ba)[0x7faf9103877a]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(+0x6237f96)[0x7faf91037f96]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0xa41)[0x7faf90d45601]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x2f)[0x7faf90d44b87]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x266)[0x7faf90f4ac7a]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(LLVMRustWriteOutputFile+0x190)[0x7faf973d8218]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x49d7e55)[0x7faf973d7e55]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x49d573d)[0x7faf973d573d]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x49d5402)[0x7faf973d5402]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x4a123ed)[0x7faf974123ed]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x4a11ec2)[0x7faf97411ec2]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libstd-2d08990d644ac786.so(rust_metadata_std_85008a29cc0b7dba+0xbf675)[0x7faf9880c675]
/lib64/libc.so.6(+0x8e897)[0x7faf985d5897]
/lib64/libc.so.6(+0x115a5c)[0x7faf9865ca5c]

note: we would appreciate a report at https://github.com/rust-lang/rust
   Compiling anyhow v1.0.79
   Compiling const_format v0.2.32
   Compiling humantime v2.1.0
   Compiling uuid v1.6.1
   Compiling enumflags2 v0.7.8
   Compiling serde_spanned v0.6.5
   Compiling toml_datetime v0.6.5
   Compiling argh_shared v0.1.12
   Compiling regex-automata v0.1.10
   Compiling toml_edit v0.21.0
   Compiling argh_derive v0.1.12
   Compiling futures-executor v0.3.30
   Compiling proc-macro-crate v1.3.1
   Compiling async-io v1.13.0
   Compiling futures v0.3.30
   Compiling matchers v0.1.0
   Compiling regex v1.10.2
   Compiling zvariant_derive v3.15.0
   Compiling tracing-subscriber v0.3.18
   Compiling zbus_macros v3.14.1
   Compiling serialport v4.3.0
   Compiling xdg-home v1.0.0
   Compiling argh v0.1.12
   Compiling toml v0.8.8
   Compiling mio-serial v5.0.5
   Compiling zvariant v3.15.0
   Compiling tokio-util v0.7.10
   Compiling tokio-serial v5.4.4
   Compiling tokio-stream v0.1.14
   Compiling tokio-modbus v0.10.0
   Compiling zbus_names v2.6.0
   Compiling zbus v3.14.1
   Compiling fsipc v0.9.5
   Compiling PROJECT_NAME v0.0.0 (/home/spider/Projects/PROJECT_NAME)
    Finished test [unoptimized + debuginfo] target(s) in 21.95s
     Running unittests src/main.rs (/home/spider/Projects/PROJECT_NAME/target/debug/deps/PROJECT_NAME-fc5799b1d32732ae)

running 7 tests
test modbus::convert::test_f32be_from_u16 ... ok
test modbus::convert::test_f32le_from_u16 ... ok
test modbus::convert::test_i16_roundtrip ... ok
test modbus::convert::test_i32le_from_u16 ... ok
test modbus::convert::test_i32be_from_u16 ... ok
test modbus::convert::test_i32le_roundtrip ... ok
test modbus::convert::test_u16_roundtrip ... ok

test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Backtrace

``` error: rustc interrupted by SIGSEGV, printing backtrace /home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x2bbe886)[0x7faf955be886] /lib64/libc.so.6(+0x3e9a0)[0x7faf985859a0] /home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm16SelectionDAGISel17CodeGenAndEmitDAGEv+0xe7f)[0x7faf90da53db] /home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm16SelectionDAGISel20SelectAllBasicBlocksERKNS_8FunctionE+0x16be)[0x7faf9142623e] /home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm16SelectionDAGISel20runOnMachineFunctionERNS_15MachineFunctionE+0x7ba)[0x7faf9103877a] /home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(+0x6237f96)[0x7faf91037f96] /home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0xa41)[0x7faf90d45601] /home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x2f)[0x7faf90d44b87] /home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x266)[0x7faf90f4ac7a] /home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(LLVMRustWriteOutputFile+0x190)[0x7faf973d8218] /home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x49d7e55)[0x7faf973d7e55] /home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x49d573d)[0x7faf973d573d] /home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x49d5402)[0x7faf973d5402] /home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x4a123ed)[0x7faf974123ed] /home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x4a11ec2)[0x7faf97411ec2] /home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libstd-2d08990d644ac786.so(rust_metadata_std_85008a29cc0b7dba+0xbf675)[0x7faf9880c675] /lib64/libc.so.6(+0x8e897)[0x7faf985d5897] /lib64/libc.so.6(+0x115a5c)[0x7faf9865ca5c] note: we would appreciate a report at https://github.com/rust-lang/rust ```

Spindel commented 6 months ago

Even more fun, it's repeatable, at least on this single one machine!

spider@nerk:~/Projects/PROJECT_NAEME/src/modbus$ cargo test
error: rustc interrupted by SIGSEGV, printing backtrace

/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x2bbe886)[0x7faf955be886]
/lib64/libc.so.6(+0x3e9a0)[0x7faf985859a0]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm16SelectionDAGISel17CodeGenAndEmitDAGEv+0xe7f)[0x7faf90da53db]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm16SelectionDAGISel20SelectAllBasicBlocksERKNS_8FunctionE+0x16be)[0x7faf9142623e]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm16SelectionDAGISel20runOnMachineFunctionERNS_15MachineFunctionE+0x7ba)[0x7faf9103877a]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(+0x6237f96)[0x7faf91037f96]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0xa41)[0x7faf90d45601]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x2f)[0x7faf90d44b87]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.77.2-stable.so(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x266)[0x7faf90f4ac7a]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(LLVMRustWriteOutputFile+0x190)[0x7faf973d8218]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x49d7e55)[0x7faf973d7e55]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x49d573d)[0x7faf973d573d]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x49d5402)[0x7faf973d5402]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x4a123ed)[0x7faf974123ed]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-cf038663a889d84a.so(+0x4a11ec2)[0x7faf97411ec2]
/home/spider/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libstd-2d08990d644ac786.so(rust_metadata_std_85008a29cc0b7dba+0xbf675)[0x7faf9880c675]
/lib64/libc.so.6(+0x8e897)[0x7faf985d5897]
/lib64/libc.so.6(+0x115a5c)[0x7faf9865ca5c]

note: we would appreciate a report at https://github.com/rust-lang/rust
    Finished test [unoptimized + debuginfo] target(s) in 0.09s
     Running unittests src/main.rs (/home/spider/Projects/PROJECT_NAEME/target/debug/deps/PROJECT_NAEME-fc5799b1d32732ae)

running 7 tests
test modbus::convert::test_f32be_from_u16 ... ok
test modbus::convert::test_i16_roundtrip ... ok
test modbus::convert::test_i32be_from_u16 ... ok
test modbus::convert::test_f32le_from_u16 ... ok
test modbus::convert::test_u16_roundtrip ... ok
test modbus::convert::test_i32le_roundtrip ... ok
test modbus::convert::test_i32le_from_u16 ... ok

test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
saethlin commented 6 months ago

I've filed it as an ICE as it's techincally a compiler crashing, but I really do not know what to file this as.

I-crash :wink:

This is sort of crash is usually a disabled LLVM assertion. Can you set this in your config.toml?

[llvm]
assertions = true
lqd commented 6 months ago

This looks to be using stable rather than a custom rustc. If that's indeed the case, the equivalent should be to try using a nightly with llvm assertions enabled, e.g.using rustup-toolchain-install-master with the alt flag, rustup-toolchain-install-master -a.

Spindel commented 6 months ago

The good news is that it works, the bad news is that there's no more faults so no more useful information. And after swapping back to the stable release, I'm also not getting any faults again, so I have no idea what's up here. :/