rust-lang / rust

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

rustc ICE while building proc-macro2 from cbindgen with cross-built 1.74.1 on mipsel-unknown-netbsd #118978

Open he32 opened 10 months ago

he32 commented 10 months ago

Code

Actually, "try to build cbindgen" is the test case.

Meta

rustc --version --verbose:

mipsel: {21} rustc --version --verbose
rustc 1.74.1 (a28077b28 2023-12-04) (built from a source tarball)
binary: rustc
commit-hash: a28077b28a02b92985b3a3faecf92813155f1ea1
commit-date: 2023-12-04
host: mipsel-unknown-netbsd
release: 1.74.1
LLVM version: 17.0.4
mipsel: {22} 

Error output

   Compiling proc-macro2 v1.0.66
thread 'rustc' panicked at /usr/pkgsrc/wip/rust174/work/rustc-1.74.1-src/compiler/rustc_index/src/bit_set.rs:186:9:
assertion failed: elem.index() < self.domain_size
stack backtrace:
   0: 0x755bec2c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha7b49371df53f699
   1: 0x7564aa90 - core::fmt::write::h805ee0c3edd3e2e1
   2: 0x7559aa40 - std::io::Write::write_fmt::h084a79c56279cb6e
   3: 0x755be9bc - std::sys_common::backtrace::print::h20065b616164627a
   4: 0x755a5284 - std::panicking::default_hook::{{closure}}::hd447b61bce132d1f
   5: 0x755a4d4c - std::panicking::default_hook::hc4c6423fef5427ca
   6: 0x760af444 - <std[5da1dfc257c72e9f]::panicking::default_hook as core[d17ab69d8aaa8776]::ops::function::Fn<(&core[d17ab69d8aaa8776]::panic::panic_info::PanicInfo,)>>::call
   7: 0x760ad64c - std[5da1dfc257c72e9f]::panicking::update_hook::<alloc[f8a1db3ee2de37b1]::boxed::Box<rustc_driver_impl[e01c6a9a5ad22865]::install_ice_hook::{closure#0}>>::{closure#0}
   8: 0x755a67c0 - std::panicking::rust_panic_with_hook::h3221a5f707e252a7
   9: 0x755bf1ec - std::panicking::begin_panic_handler::{{closure}}::h4be4ede41b2c5899
  10: 0x755bef2c - std::sys_common::backtrace::__rust_end_short_backtrace::h00a9dca0c630b0ca
  11: 0x755a606c - rust_begin_unwind
  12: 0x75567228 - core::panicking::panic_fmt::h5671ef9771c41f45
  13: 0x755672e0 - core::panicking::panic::h30a6e4d2d29f7327
  14: 0x7a8e9d88 - <rustc_mir_dataflow[119f570acbd91996]::impls::storage_liveness::MaybeStorageLive as rustc_mir_dataflow[119f570acbd91996]::framework::AnalysisDomain>::initialize_start_block
  15: 0x79cc5cfc - <rustc_mir_dataflow[119f570acbd91996]::framework::engine::Engine<rustc_mir_dataflow[119f570acbd91996]::impls::storage_liveness::MaybeStorageLive>>::new
  16: 0x79cbf6fc - <rustc_mir_dataflow[119f570acbd91996]::framework::engine::Engine<rustc_mir_dataflow[119f570acbd91996]::impls::storage_liveness::MaybeStorageLive>>::new_gen_kill
  17: 0x79c9a478 - <rustc_const_eval[981e688f9f0a1b2d]::transform::validate::Validator as rustc_middle[90deda09a7c0bc4a]::mir::MirPass>::run_pass
  18: 0x79a56848 - rustc_mir_transform[714b9951dd140d2d]::pass_manager::run_passes_inner
  19: 0x79b09ee8 - rustc_mir_transform[714b9951dd140d2d]::shim::make_shim
  20: 0x7a97a600 - rustc_query_impl[5e3aadf38d8745c7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5e3aadf38d8745c7]::query_impl::mir_shims::dynamic_query::{closure#2}::{closure#0}, rustc_middle[90deda09a7c0bc4a]::query::erase::Erased<[u8; 4usize]>>
  21: 0x7a9b87cc - <rustc_query_impl[5e3aadf38d8745c7]::query_impl::mir_shims::dynamic_query::{closure#2} as core[d17ab69d8aaa8776]::ops::function::FnOnce<(rustc_middle[90deda09a7c0bc4a]::ty::context::TyCtxt, rustc_middle[90deda09a7c0bc4a]::ty::instance::InstanceDef)>>::call_once
  22: 0x7ac62ea4 - rustc_query_system[c6425c99b52af145]::query::plumbing::try_execute_query::<rustc_query_impl[5e3aadf38d8745c7]::DynamicConfig<rustc_query_system[c6425c99b52af145]::query::caches::DefaultCache<rustc_middle[90deda09a7c0bc4a]::ty::instance::InstanceDef, rustc_middle[90deda09a7c0bc4a]::query::erase::Erased<[u8; 4usize]>>, false, false, false>, rustc_query_impl[5e3aadf38d8745c7]::plumbing::QueryCtxt, false>
  23: 0x7a9df634 - rustc_query_impl[5e3aadf38d8745c7]::query_impl::mir_shims::get_query_non_incr::__rust_end_short_backtrace
  24: 0x7bf16ef4 - <rustc_middle[90deda09a7c0bc4a]::ty::context::TyCtxt>::instance_mir
  25: 0x798e7328 - rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_used_items
  26: 0x798e5218 - rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_items_rec
  27: 0x798e5940 - rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_items_rec
  28: 0x798e5940 - rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_items_rec
  29: 0x798e5940 - rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_items_rec
  30: 0x79922788 - <core[d17ab69d8aaa8776]::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures[5829ff6536763ce9]::sync::parallel::disabled::par_for_each_in<alloc[f8a1db3ee2de37b1]::vec::Vec<rustc_middle[90deda09a7c0bc4a]::mir::mono::MonoItem>, rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}::{closure#0}> as core[d17ab69d8aaa8776]::ops::function::FnOnce<()>>::call_once
  31: 0x7991784c - std[5da1dfc257c72e9f]::panicking::try::do_call::<core[d17ab69d8aaa8776]::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures[5829ff6536763ce9]::sync::parallel::disabled::par_for_each_in<alloc[f8a1db3ee2de37b1]::vec::Vec<rustc_middle[90deda09a7c0bc4a]::mir::mono::MonoItem>, rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}::{closure#0}>, ()>
  32: 0x79919bd8 - __rust_try.llvm.6328978506315838532
  33: 0x79927178 - rustc_data_structures[5829ff6536763ce9]::sync::parallel::disabled::par_for_each_in::<alloc[f8a1db3ee2de37b1]::vec::Vec<rustc_middle[90deda09a7c0bc4a]::mir::mono::MonoItem>, rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>
  34: 0x7991e534 - <rustc_session[f81205650fa30331]::session::Session>::time::<(), rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_crate_mono_items::{closure#1}>
  35: 0x798e31ec - rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_crate_mono_items
  36: 0x798f0044 - rustc_monomorphize[e3ee30ac619f3ab0]::partitioning::collect_and_partition_mono_items
  37: 0x7a979910 - rustc_query_impl[5e3aadf38d8745c7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5e3aadf38d8745c7]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle[90deda09a7c0bc4a]::query::erase::Erased<[u8; 12usize]>>
  38: 0x7aaaea08 - <rustc_query_impl[5e3aadf38d8745c7]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core[d17ab69d8aaa8776]::ops::function::FnOnce<(rustc_middle[90deda09a7c0bc4a]::ty::context::TyCtxt, ())>>::call_once
  39: 0x7ac1c7d4 - rustc_query_system[c6425c99b52af145]::query::plumbing::try_execute_query::<rustc_query_impl[5e3aadf38d8745c7]::DynamicConfig<rustc_query_system[c6425c99b52af145]::query::caches::SingleCache<rustc_middle[90deda09a7c0bc4a]::query::erase::Erased<[u8; 12usize]>>, false, false, false>, rustc_query_impl[5e3aadf38d8745c7]::plumbing::QueryCtxt, false>
  40: 0x7aa0176c - rustc_query_impl[5e3aadf38d8745c7]::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace
  41: 0x763e6c20 - rustc_codegen_ssa[b744126ae3d1542d]::base::codegen_crate::<rustc_codegen_llvm[937b036bca00b85b]::LlvmCodegenBackend>
  42: 0x76398848 - <rustc_codegen_llvm[937b036bca00b85b]::LlvmCodegenBackend as rustc_codegen_ssa[b744126ae3d1542d]::traits::backend::CodegenBackend>::codegen_crate
  43: 0x763433c8 - <rustc_session[f81205650fa30331]::session::Session>::time::<alloc[f8a1db3ee2de37b1]::boxed::Box<dyn core[d17ab69d8aaa8776]::any::Any>, rustc_interface[4ee7e801a40d9aaf]::passes::start_codegen::{closure#0}>
  44: 0x7627ae38 - rustc_interface[4ee7e801a40d9aaf]::passes::start_codegen
  45: 0x76262a18 - <rustc_middle[90deda09a7c0bc4a]::ty::context::GlobalCtxt>::enter::<<rustc_interface[4ee7e801a40d9aaf]::queries::Queries>::ongoing_codegen::{closure#0}, core[d17ab69d8aaa8776]::result::Result<alloc[f8a1db3ee2de37b1]::boxed::Box<dyn core[d17ab69d8aaa8776]::any::Any>, rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>
  46: 0x762996dc - <rustc_interface[4ee7e801a40d9aaf]::queries::Queries>::ongoing_codegen
  47: 0x760b07b8 - <rustc_interface[4ee7e801a40d9aaf]::interface::Compiler>::enter::<rustc_driver_impl[e01c6a9a5ad22865]::run_compiler::{closure#1}::{closure#2}, core[d17ab69d8aaa8776]::result::Result<core[d17ab69d8aaa8776]::option::Option<rustc_interface[4ee7e801a40d9aaf]::queries::Linker>, rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>
  48: 0x760a95b0 - std[5da1dfc257c72e9f]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[4ee7e801a40d9aaf]::util::run_in_thread_with_globals<rustc_interface[4ee7e801a40d9aaf]::interface::run_compiler<core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>, rustc_driver_impl[e01c6a9a5ad22865]::run_compiler::{closure#1}>::{closure#0}, core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>
  49: 0x760ac85c - std[5da1dfc257c72e9f]::panicking::try::do_call::<core[d17ab69d8aaa8776]::panic::unwind_safe::AssertUnwindSafe<<std[5da1dfc257c72e9f]::thread::Builder>::spawn_unchecked_<rustc_interface[4ee7e801a40d9aaf]::util::run_in_thread_with_globals<rustc_interface[4ee7e801a40d9aaf]::interface::run_compiler<core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>, rustc_driver_impl[e01c6a9a5ad22865]::run_compiler::{closure#1}>::{closure#0}, core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>::{closure#1}::{closure#0}>, core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>
  50: 0x760af4dc - __rust_try.llvm.7443979382519237067
  51: 0x760add68 - <<std[5da1dfc257c72e9f]::thread::Builder>::spawn_unchecked_<rustc_interface[4ee7e801a40d9aaf]::util::run_in_thread_with_globals<rustc_interface[4ee7e801a40d9aaf]::interface::run_compiler<core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>, rustc_driver_impl[e01c6a9a5ad22865]::run_compiler::{closure#1}>::{closure#0}, core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>::{closure#1} as core[d17ab69d8aaa8776]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  52: 0x75582704 - std::sys::unix::thread::Thread::new::thread_start::h7511762b03c61343
  53: 0x7507e7b0 - pthread__create_tramp
                       at /usr/src/lib/libpthread/pthread.c:29
  54: 0x75383e70 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.74.1 (a28077b28 2023-12-04) (built from a source tarball) running on mipsel-unknown-netbsd

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debug-assertions=off

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [mir_shims] generating MIR shim for `core::ptr::drop_in_place`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
thread 'rustc' panicked at /usr/pkgsrc/wip/rust174/work/rustc-1.74.1-src/compiler/rustc_index/src/bit_set.rs:186:9:
assertion failed: elem.index() < self.domain_size
stack backtrace:
   0: 0x755bec2c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha7b49371df53f699
   1: 0x7564aa90 - core::fmt::write::h805ee0c3edd3e2e1
   2: 0x7559aa40 - std::io::Write::write_fmt::h084a79c56279cb6e
   3: 0x755be9bc - std::sys_common::backtrace::print::h20065b616164627a
   4: 0x755a5284 - std::panicking::default_hook::{{closure}}::hd447b61bce132d1f
   5: 0x755a4d4c - std::panicking::default_hook::hc4c6423fef5427ca
   6: 0x760af444 - <std[5da1dfc257c72e9f]::panicking::default_hook as core[d17ab69d8aaa8776]::ops::function::Fn<(&core[d17ab69d8aaa8776]::panic::panic_info::PanicInfo,)>>::call
   7: 0x760ad64c - std[5da1dfc257c72e9f]::panicking::update_hook::<alloc[f8a1db3ee2de37b1]::boxed::Box<rustc_driver_impl[e01c6a9a5ad22865]::install_ice_hook::{closure#0}>>::{closure#0}
   8: 0x755a67c0 - std::panicking::rust_panic_with_hook::h3221a5f707e252a7
   9: 0x755bf1ec - std::panicking::begin_panic_handler::{{closure}}::h4be4ede41b2c5899
  10: 0x755bef2c - std::sys_common::backtrace::__rust_end_short_backtrace::h00a9dca0c630b0ca
  11: 0x755a606c - rust_begin_unwind
  12: 0x75567228 - core::panicking::panic_fmt::h5671ef9771c41f45
  13: 0x755672e0 - core::panicking::panic::h30a6e4d2d29f7327
  14: 0x7a8e9d88 - <rustc_mir_dataflow[119f570acbd91996]::impls::storage_liveness::MaybeStorageLive as rustc_mir_dataflow[119f570acbd91996]::framework::AnalysisDomain>::initialize_start_block
  15: 0x79cc5cfc - <rustc_mir_dataflow[119f570acbd91996]::framework::engine::Engine<rustc_mir_dataflow[119f570acbd91996]::impls::storage_liveness::MaybeStorageLive>>::new
  16: 0x79cbf6fc - <rustc_mir_dataflow[119f570acbd91996]::framework::engine::Engine<rustc_mir_dataflow[119f570acbd91996]::impls::storage_liveness::MaybeStorageLive>>::new_gen_kill
  17: 0x79c9a478 - <rustc_const_eval[981e688f9f0a1b2d]::transform::validate::Validator as rustc_middle[90deda09a7c0bc4a]::mir::MirPass>::run_pass
  18: 0x79a56848 - rustc_mir_transform[714b9951dd140d2d]::pass_manager::run_passes_inner
  19: 0x79b09ee8 - rustc_mir_transform[714b9951dd140d2d]::shim::make_shim
  20: 0x7a97a600 - rustc_query_impl[5e3aadf38d8745c7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5e3aadf38d8745c7]::query_impl::mir_shims::dynamic_query::{closure#2}::{closure#0}, rustc_middle[90deda09a7c0bc4a]::query::erase::Erased<[u8; 4usize]>>
  21: 0x7a9b87cc - <rustc_query_impl[5e3aadf38d8745c7]::query_impl::mir_shims::dynamic_query::{closure#2} as core[d17ab69d8aaa8776]::ops::function::FnOnce<(rustc_middle[90deda09a7c0bc4a]::ty::context::TyCtxt, rustc_middle[90deda09a7c0bc4a]::ty::instance::InstanceDef)>>::call_once
  22: 0x7ac62ea4 - rustc_query_system[c6425c99b52af145]::query::plumbing::try_execute_query::<rustc_query_impl[5e3aadf38d8745c7]::DynamicConfig<rustc_query_system[c6425c99b52af145]::query::caches::DefaultCache<rustc_middle[90deda09a7c0bc4a]::ty::instance::InstanceDef, rustc_middle[90deda09a7c0bc4a]::query::erase::Erased<[u8; 4usize]>>, false, false, false>, rustc_query_impl[5e3aadf38d8745c7]::plumbing::QueryCtxt, false>
  23: 0x7a9df634 - rustc_query_impl[5e3aadf38d8745c7]::query_impl::mir_shims::get_query_non_incr::__rust_end_short_backtrace
  24: 0x7bf16ef4 - <rustc_middle[90deda09a7c0bc4a]::ty::context::TyCtxt>::instance_mir
  25: 0x798e7328 - rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_used_items
  26: 0x798e5218 - rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_items_rec
  27: 0x798e5940 - rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_items_rec
  28: 0x79922788 - <core[d17ab69d8aaa8776]::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures[5829ff6536763ce9]::sync::parallel::disabled::par_for_each_in<alloc[f8a1db3ee2de37b1]::vec::Vec<rustc_middle[90deda09a7c0bc4a]::mir::mono::MonoItem>, rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}::{closure#0}> as core[d17ab69d8aaa8776]::ops::function::FnOnce<()>>::call_once
  29: 0x7991784c - std[5da1dfc257c72e9f]::panicking::try::do_call::<core[d17ab69d8aaa8776]::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures[5829ff6536763ce9]::sync::parallel::disabled::par_for_each_in<alloc[f8a1db3ee2de37b1]::vec::Vec<rustc_middle[90deda09a7c0bc4a]::mir::mono::MonoItem>, rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}::{closure#0}>, ()>
  30: 0x79919bd8 - __rust_try.llvm.6328978506315838532
  31: 0x79927178 - rustc_data_structures[5829ff6536763ce9]::sync::parallel::disabled::par_for_each_in::<alloc[f8a1db3ee2de37b1]::vec::Vec<rustc_middle[90deda09a7c0bc4a]::mir::mono::MonoItem>, rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>
  32: 0x7991e534 - <rustc_session[f81205650fa30331]::session::Session>::time::<(), rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_crate_mono_items::{closure#1}>
  33: 0x798e31ec - rustc_monomorphize[e3ee30ac619f3ab0]::collector::collect_crate_mono_items
  34: 0x798f0044 - rustc_monomorphize[e3ee30ac619f3ab0]::partitioning::collect_and_partition_mono_items
  35: 0x7a979910 - rustc_query_impl[5e3aadf38d8745c7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5e3aadf38d8745c7]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle[90deda09a7c0bc4a]::query::erase::Erased<[u8; 12usize]>>
  36: 0x7aaaea08 - <rustc_query_impl[5e3aadf38d8745c7]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core[d17ab69d8aaa8776]::ops::function::FnOnce<(rustc_middle[90deda09a7c0bc4a]::ty::context::TyCtxt, ())>>::call_once
  37: 0x7ac1c7d4 - rustc_query_system[c6425c99b52af145]::query::plumbing::try_execute_query::<rustc_query_impl[5e3aadf38d8745c7]::DynamicConfig<rustc_query_system[c6425c99b52af145]::query::caches::SingleCache<rustc_middle[90deda09a7c0bc4a]::query::erase::Erased<[u8; 12usize]>>, false, false, false>, rustc_query_impl[5e3aadf38d8745c7]::plumbing::QueryCtxt, false>
  38: 0x7aa0176c - rustc_query_impl[5e3aadf38d8745c7]::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace
  39: 0x763e6c20 - rustc_codegen_ssa[b744126ae3d1542d]::base::codegen_crate::<rustc_codegen_llvm[937b036bca00b85b]::LlvmCodegenBackend>
  40: 0x76398848 - <rustc_codegen_llvm[937b036bca00b85b]::LlvmCodegenBackend as rustc_codegen_ssa[b744126ae3d1542d]::traits::backend::CodegenBackend>::codegen_crate
  41: 0x763433c8 - <rustc_session[f81205650fa30331]::session::Session>::time::<alloc[f8a1db3ee2de37b1]::boxed::Box<dyn core[d17ab69d8aaa8776]::any::Any>, rustc_interface[4ee7e801a40d9aaf]::passes::start_codegen::{closure#0}>
  42: 0x7627ae38 - rustc_interface[4ee7e801a40d9aaf]::passes::start_codegen
  43: 0x76262a18 - <rustc_middle[90deda09a7c0bc4a]::ty::context::GlobalCtxt>::enter::<<rustc_interface[4ee7e801a40d9aaf]::queries::Queries>::ongoing_codegen::{closure#0}, core[d17ab69d8aaa8776]::result::Result<alloc[f8a1db3ee2de37b1]::boxed::Box<dyn core[d17ab69d8aaa8776]::any::Any>, rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>
  44: 0x762996dc - <rustc_interface[4ee7e801a40d9aaf]::queries::Queries>::ongoing_codegen
  45: 0x760b07b8 - <rustc_interface[4ee7e801a40d9aaf]::interface::Compiler>::enter::<rustc_driver_impl[e01c6a9a5ad22865]::run_compiler::{closure#1}::{closure#2}, core[d17ab69d8aaa8776]::result::Result<core[d17ab69d8aaa8776]::option::Option<rustc_interface[4ee7e801a40d9aaf]::queries::Linker>, rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>
  46: 0x760a95b0 - std[5da1dfc257c72e9f]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[4ee7e801a40d9aaf]::util::run_in_thread_with_globals<rustc_interface[4ee7e801a40d9aaf]::interface::run_compiler<core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>, rustc_driver_impl[e01c6a9a5ad22865]::run_compiler::{closure#1}>::{closure#0}, core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>
  47: 0x760ac85c - std[5da1dfc257c72e9f]::panicking::try::do_call::<core[d17ab69d8aaa8776]::panic::unwind_safe::AssertUnwindSafe<<std[5da1dfc257c72e9f]::thread::Builder>::spawn_unchecked_<rustc_interface[4ee7e801a40d9aaf]::util::run_in_thread_with_globals<rustc_interface[4ee7e801a40d9aaf]::interface::run_compiler<core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>, rustc_driver_impl[e01c6a9a5ad22865]::run_compiler::{closure#1}>::{closure#0}, core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>::{closure#1}::{closure#0}>, core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>
  48: 0x760af4dc - __rust_try.llvm.7443979382519237067
  49: 0x760add68 - <<std[5da1dfc257c72e9f]::thread::Builder>::spawn_unchecked_<rustc_interface[4ee7e801a40d9aaf]::util::run_in_thread_with_globals<rustc_interface[4ee7e801a40d9aaf]::interface::run_compiler<core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>, rustc_driver_impl[e01c6a9a5ad22865]::run_compiler::{closure#1}>::{closure#0}, core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d17ab69d8aaa8776]::result::Result<(), rustc_span[da9715da3b3c8079]::ErrorGuaranteed>>::{closure#1} as core[d17ab69d8aaa8776]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  50: 0x75582704 - std::sys::unix::thread::Thread::new::thread_start::h7511762b03c61343
  51: 0x7507e7b0 - pthread__create_tramp
                       at /usr/src/lib/libpthread/pthread.c:29
  52: 0x75383e70 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.74.1 (a28077b28 2023-12-04) (built from a source tarball) running on mipsel-unknown-netbsd

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debug-assertions=off

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [mir_shims] generating MIR shim for `core::ops::function::FnOnce::call_once`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `proc-macro2` (build script)
*** Error code 101

Stop.
Backtrace

See above. I think that's already included...

he32 commented 10 months ago

This doesn't appear to be a resource shortage issue, the virtual size of rustc at the time of ICE was around 230MB, and doing "unlimit datasize" before building makes no difference.

saethlin commented 10 months ago

Yikes I just tried using Miri to replicate such a cross-build, and got these compile errors from

cargo +nightly miri test --target=mipsel-unknown-netbsd
error[E0308]: mismatched types
    --> /home/ben/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/thread.rs:387:59
     |
387  | ...                   match libc::_cpuset_isset(i, set) {
     |                             ------------------- ^ expected `u32`, found `u64`
     |                             |
     |                             arguments to this function are incorrect
     |
note: function defined here
    --> /home/ben/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.150/src/unix/bsd/netbsdlike/netbsd/mod.rs:2782:12
     |
2782 |     pub fn _cpuset_isset(cpu: cpuid_t, set: *const cpuset_t) -> ::c_int;
     |            ^^^^^^^^^^^^^
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
     |
387  |                                 match libc::_cpuset_isset(i.try_into().unwrap(), set) {
     |                                                            ++++++++++++++++++++

error[E0277]: the trait bound `i32: core::convert::From<u32>` is not satisfied
  --> /home/ben/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/thread_parking/netbsd.rs:37:37
   |
37 |         tv_nsec: dur.subsec_nanos().into(),
   |                                     ^^^^ the trait `core::convert::From<u32>` is not implemented for `i32`
   |
   = help: the following other types implement trait `core::convert::From<T>`:
             <i32 as core::convert::From<bool>>
             <i32 as core::convert::From<i8>>
             <i32 as core::convert::From<i16>>
             <i32 as core::convert::From<u8>>
             <i32 as core::convert::From<u16>>
             <i32 as core::convert::From<core::num::NonZeroI32>>
   = note: required for `u32` to implement `core::convert::Into<i32>`

Have you patched std to fix this?

he32 commented 10 months ago

Yes, we found that cpuid_t was mis-defined on NetBSD, causing issues for all our ILP32 targets.

Let's see... That's https://github.com/rust-lang/rust/pull/116665.

I have re-tried with binaries of rust 1.73.1 (fails the same way as 1.74.1) and 1.72.1, which comes across this hurdle. The slow build on my qemu-hosted mips32-based "mipsel" host has now come to

===> Building for cbindgen-0.26.0
   Compiling proc-macro2 v1.0.66
   Compiling quote v1.0.27
   Compiling unicode-ident v1.0.8
   Compiling libc v0.2.144

and is still going.

I have a suspicion that this is an LLVM issue -- all these rust variants were (cross-)built with the LLVM which comes embedded in the rust compiler source tar file. And I have a further vague suspicion that this is a CPU-family issue and not a OS/platform issue, so re-trying this with one of the Linux mipsel targets should (if my suspcion is correct) reproduce the issue.

saethlin commented 10 months ago

It would not at all surprise me if this is just another MIPS miscompilation.

he32 commented 10 months ago

Just for reference:

rust 1.72.1 contains LLVM version 16.0.5
rust 1.73.0 contains LLVM version 17.0.2
rust 1.74.1 contains LLVM version 17.0.4
he32 commented 10 months ago

However, building rust 1.74.1 natively with an external LLVM (which might make 1.74.1 succeed) presents its own set of challenges, due to this platform's inability to handle sufficient physical memory to make such a build feasible within finite time. I've maxed out the VM with 512MB "physical" memory, and that will just be inadequate to host a native build of rust. The only hope (which I've not yet set up), is to use a 32-bit chroot inside a 64-bit mips64 system (which can handle more physical memory).