Open LaoLittle opened 1 year ago
I tried this code:
use std::arch::asm; fn main() { extern "C" fn call() { println!("CALL"); } call(); //println!("Start"); unsafe { abc(call as usize); } } pub unsafe extern "C" fn abc(f: usize) { asm!( "local.get 0", "call_indirect (i32) -> ()", options(noreturn) ) }
rustc --version --verbose:
rustc --version --verbose
rustc 1.74.0-nightly (ca2b74f1a 2023-09-14) binary: rustc commit-hash: ca2b74f1ae5075d62e223c0a91574a1fc3f51c7c commit-date: 2023-09-14 host: x86_64-unknown-linux-gnu release: 1.74.0-nightly LLVM version: 17.0.0
``` error: rustc interrupted by SIGSEGV, printing backtrace /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-8e42d501a7efdfb9.so(+0x3194066)[0x7fea5bf94066] /lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7fea58a42520] /lib/x86_64-linux-gnu/libc.so.6(+0x1a0e90)[0x7fea58ba0e90] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(+0x47e187a)[0x7fea557e187a] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(+0x47e70f7)[0x7fea557e70f7] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(+0x47e3b6f)[0x7fea557e3b6f] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(+0x47e14a7)[0x7fea557e14a7] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(_ZN4llvm16MCObjectStreamer10finishImplEv+0xdb)[0x7fea57822d5b] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(_ZN4llvm10AsmPrinter14doFinalizationERNS_6ModuleE+0x734)[0x7fea5767e804] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(_ZN4llvm13FPPassManager14doFinalizationERNS_6ModuleE+0x4a)[0x7fea576d278a] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x37b)[0x7fea573bde7b] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-8e42d501a7efdfb9.so(+0x264f386)[0x7fea5b44f386] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-8e42d501a7efdfb9.so(+0x264e238)[0x7fea5b44e238] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-8e42d501a7efdfb9.so(+0x264caec)[0x7fea5b44caec] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-8e42d501a7efdfb9.so(+0x2649a58)[0x7fea5b449a58] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-8e42d501a7efdfb9.so(+0x26493de)[0x7fea5b4493de] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-8e42d501a7efdfb9.so(+0x2647097)[0x7fea5b447097] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-8e42d501a7efdfb9.so(+0x2646c76)[0x7fea5b446c76] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libstd-19964a87984cce8a.so(rust_metadata_std_843b1ee06368cddb+0x10c075)[0x7fea58d71075] /lib/x86_64-linux-gnu/libc.so.6(+0x94b43)[0x7fea58a94b43] /lib/x86_64-linux-gnu/libc.so.6(+0x126a00)[0x7fea58b26a00] note: we would appreciate a report at https://github.com/rust-lang/rust error: could not compile `rstest` (bin "rstest") Caused by: process didn't exit successfully: `/home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name rstest --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=202 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=754798f590adad55 -C extra-filename=-754798f590adad55 --out-dir /home/laolittle/RustProjects/rstest/target/wasm32-wasi/debug/deps --target wasm32-wasi -C incremental=/home/laolittle/RustProjects/rstest/target/wasm32-wasi/debug/incremental -L dependency=/home/laolittle/RustProjects/rstest/target/wasm32-wasi/debug/deps -L dependency=/home/laolittle/RustProjects/rstest/target/debug/deps` (signal: 11, SIGSEGV: invalid memory reference) ```
LLVM loves to crash whenever it receives invalid inline asm.
I tried this code:
Meta
rustc --version --verbose
:Backtrace
``` error: rustc interrupted by SIGSEGV, printing backtrace /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-8e42d501a7efdfb9.so(+0x3194066)[0x7fea5bf94066] /lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7fea58a42520] /lib/x86_64-linux-gnu/libc.so.6(+0x1a0e90)[0x7fea58ba0e90] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(+0x47e187a)[0x7fea557e187a] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(+0x47e70f7)[0x7fea557e70f7] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(+0x47e3b6f)[0x7fea557e3b6f] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(+0x47e14a7)[0x7fea557e14a7] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(_ZN4llvm16MCObjectStreamer10finishImplEv+0xdb)[0x7fea57822d5b] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(_ZN4llvm10AsmPrinter14doFinalizationERNS_6ModuleE+0x734)[0x7fea5767e804] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(_ZN4llvm13FPPassManager14doFinalizationERNS_6ModuleE+0x4a)[0x7fea576d278a] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.74.0-nightly.so(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x37b)[0x7fea573bde7b] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-8e42d501a7efdfb9.so(+0x264f386)[0x7fea5b44f386] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-8e42d501a7efdfb9.so(+0x264e238)[0x7fea5b44e238] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-8e42d501a7efdfb9.so(+0x264caec)[0x7fea5b44caec] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-8e42d501a7efdfb9.so(+0x2649a58)[0x7fea5b449a58] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-8e42d501a7efdfb9.so(+0x26493de)[0x7fea5b4493de] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-8e42d501a7efdfb9.so(+0x2647097)[0x7fea5b447097] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-8e42d501a7efdfb9.so(+0x2646c76)[0x7fea5b446c76] /home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libstd-19964a87984cce8a.so(rust_metadata_std_843b1ee06368cddb+0x10c075)[0x7fea58d71075] /lib/x86_64-linux-gnu/libc.so.6(+0x94b43)[0x7fea58a94b43] /lib/x86_64-linux-gnu/libc.so.6(+0x126a00)[0x7fea58b26a00] note: we would appreciate a report at https://github.com/rust-lang/rust error: could not compile `rstest` (bin "rstest") Caused by: process didn't exit successfully: `/home/laolittle/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name rstest --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=202 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=754798f590adad55 -C extra-filename=-754798f590adad55 --out-dir /home/laolittle/RustProjects/rstest/target/wasm32-wasi/debug/deps --target wasm32-wasi -C incremental=/home/laolittle/RustProjects/rstest/target/wasm32-wasi/debug/incremental -L dependency=/home/laolittle/RustProjects/rstest/target/wasm32-wasi/debug/deps -L dependency=/home/laolittle/RustProjects/rstest/target/debug/deps` (signal: 11, SIGSEGV: invalid memory reference) ```