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

-Zrandomize-layout causes ICE when compiling syn (as part of a test) (with --target) #112065

Open saethlin opened 1 year ago

saethlin commented 1 year ago
$ cargo download -x prettier-please
$ RUSTFLAGS="-Zrandomize-layout" cargo +nightly test --target=x86_64-unknown-linux-gnu --lib

rustc --version --verbose:

rustc 1.72.0-nightly (1c53407e8 2023-05-28)
binary: rustc
commit-hash: 1c53407e8c7cc922d718bde61ca34f47b6d2120f
commit-date: 2023-05-28
host: x86_64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.4

Error:

thread 'rustc' panicked at 'assertion failed: target_offset >= offset', compiler/rustc_codegen_llvm/src/type_of.rs:126:9
Backtrace

``` thread 'rustc' panicked at 'assertion failed: target_offset >= offset', compiler/rustc_codegen_llvm/src/type_of.rs:126:9 stack backtrace: 0: 0x7f48a6969921 - std::backtrace_rs::backtrace::libunwind::trace::h2f87d9d5f9ce82d6 at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7f48a6969921 - std::backtrace_rs::backtrace::trace_unsynchronized::h43da12aa2b9d3c2f at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7f48a6969921 - std::sys_common::backtrace::_print_fmt::hce2fdf626ac693ef at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/std/src/sys_common/backtrace.rs:65:5 3: 0x7f48a6969921 - ::fmt::h2c0bda5382415c6f at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7f48a69ca31f - core::fmt::rt::Argument::fmt::ha8dced8dec8d37aa at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/core/src/fmt/rt.rs:138:9 5: 0x7f48a69ca31f - core::fmt::write::h77d649aab618411d at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/core/src/fmt/mod.rs:1094:21 6: 0x7f48a695cb11 - std::io::Write::write_fmt::h30551196154004c0 at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/std/src/io/mod.rs:1713:15 7: 0x7f48a6969735 - std::sys_common::backtrace::_print::h8e2356bc7d163cad at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/std/src/sys_common/backtrace.rs:47:5 8: 0x7f48a6969735 - std::sys_common::backtrace::print::ha0cb1b28bf8aa788 at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/std/src/sys_common/backtrace.rs:34:9 9: 0x7f48a696c3f7 - std::panicking::default_hook::{{closure}}::h87bda075dafc0a5c 10: 0x7f48a696c1e4 - std::panicking::default_hook::h68a37beb1a2d6a14 at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/std/src/panicking.rs:288:9 11: 0x7f48a9b1e64b - rustc_driver_impl[7659d0211759c851]::install_ice_hook::{closure#0} 12: 0x7f48a696cb3d - as core::ops::function::Fn>::call::he0663d30994fe530 at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/alloc/src/boxed.rs:1999:9 13: 0x7f48a696cb3d - std::panicking::rust_panic_with_hook::hd2f9c684d5205393 at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/std/src/panicking.rs:709:13 14: 0x7f48a696c891 - std::panicking::begin_panic_handler::{{closure}}::h1aa3874266ff3595 at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/std/src/panicking.rs:595:13 15: 0x7f48a6969d56 - std::sys_common::backtrace::__rust_end_short_backtrace::h7f2be3d4a5840a45 at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/std/src/sys_common/backtrace.rs:151:18 16: 0x7f48a696c622 - rust_begin_unwind at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/std/src/panicking.rs:593:5 17: 0x7f48a69c65a3 - core::panicking::panic_fmt::h38dc6fd12db28774 at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/core/src/panicking.rs:67:14 18: 0x7f48a69c6633 - core::panicking::panic::hc4f30bfaae186a6f at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/core/src/panicking.rs:117:5 19: 0x7f48a7d20534 - rustc_codegen_llvm[454dee9a5a35a59a]::type_of::struct_llfields 20: 0x7f48a7d1d777 - as rustc_codegen_llvm[454dee9a5a35a59a]::type_of::LayoutLlvmExt>::llvm_type 21: 0x7f48a8581fac - >::codegen_rvalue 22: 0x7f48a8525834 - rustc_codegen_ssa[ab281534f5d7966c]::mir::codegen_mir:: 23: 0x7f48a914b3eb - rustc_codegen_llvm[454dee9a5a35a59a]::base::compile_codegen_unit::module_codegen 24: 0x7f48a9148909 - ::compile_codegen_unit 25: 0x7f48a91462b7 - rustc_codegen_ssa[ab281534f5d7966c]::base::codegen_crate:: 26: 0x7f48a9145bbb - ::codegen_crate 27: 0x7f48a8d95621 - rustc_interface[45420231614740cd]::passes::start_codegen 28: 0x7f48a8d9232d - ::enter::<::ongoing_codegen::{closure#0}::{closure#0}, core[7efe0b4e56e81f9a]::result::Result, rustc_span[2bf001af0057410c]::ErrorGuaranteed>> 29: 0x7f48a8d912ad - ::ongoing_codegen 30: 0x7f48a8d908c9 - ::enter::, rustc_span[2bf001af0057410c]::ErrorGuaranteed>> 31: 0x7f48a8d8e093 - std[1f5a572b0fe1d489]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[7659d0211759c851]::run_compiler::{closure#1}>::{closure#0}, core[7efe0b4e56e81f9a]::result::Result<(), rustc_span[2bf001af0057410c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7efe0b4e56e81f9a]::result::Result<(), rustc_span[2bf001af0057410c]::ErrorGuaranteed>> 32: 0x7f48a93ba1f5 - <::spawn_unchecked_, rustc_driver_impl[7659d0211759c851]::run_compiler::{closure#1}>::{closure#0}, core[7efe0b4e56e81f9a]::result::Result<(), rustc_span[2bf001af0057410c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7efe0b4e56e81f9a]::result::Result<(), rustc_span[2bf001af0057410c]::ErrorGuaranteed>>::{closure#1} as core[7efe0b4e56e81f9a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 33: 0x7f48a6977065 - as core::ops::function::FnOnce>::call_once::h3b74af01aa4409e3 at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/alloc/src/boxed.rs:1985:9 34: 0x7f48a6977065 - as core::ops::function::FnOnce>::call_once::h6fd53215ad4052a6 at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/alloc/src/boxed.rs:1985:9 35: 0x7f48a6977065 - std::sys::unix::thread::Thread::new::thread_start::h8df08f1507529c34 at /rustc/1c53407e8c7cc922d718bde61ca34f47b6d2120f/library/std/src/sys/unix/thread.rs:108:17 36: 0x7f48a671144b - 37: 0x7f48a6794e40 - 38: 0x0 - ```

jyn514 commented 1 year ago

I take it the RUSTDOCFLAGS here are not actually relevant, since this is crashing in LLVM? So something like RUSTFLAGS="-Zrandomize-layout" cargo +nightly test --target=x86_64-unknown-linux-gnu -j1 --lib would be a more minimal reproduction?

saethlin commented 1 year ago

Yes. Updated the issue description.

trevyn commented 1 year ago

Related / dupe of https://github.com/rust-lang/rust/issues/101646