Skip to content

"Size::sub: 0 - 8 would result in negative size" ICE on sparc #147883

@bjorn3

Description

@bjorn3

Code

#[repr(C)] pub struct C { a: f64, b: f32 } #[unsafe(no_mangle)] pub extern "C" fn foo(c: C) {}

compiled for sparc64-unknown-linux-gnu

Meta

rustc --version --verbose:

rustc 1.92.0-nightly (53a741fc4 2025-10-16) binary: rustc commit-hash: 53a741fc4b8cf2d8e7b1b2336ed8edf889db84f4 commit-date: 2025-10-16 host: x86_64-unknown-linux-gnu release: 1.92.0-nightly LLVM version: 21.1.3 

Error output

thread 'rustc' (3) panicked at /rustc-dev/53a741fc4b8cf2d8e7b1b2336ed8edf889db84f4/compiler/rustc_abi/src/lib.rs:884:13: Size::sub: 0 - 8 would result in negative size 
Backtrace

thread 'rustc' (3) panicked at /rustc-dev/53a741fc4b8cf2d8e7b1b2336ed8edf889db84f4/compiler/rustc_abi/src/lib.rs:884:13: Size::sub: 0 - 8 would result in negative size stack backtrace: 0: 0x7904d7866263 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hdfccfc3d07cf8ba1 1: 0x7904d8001c18 - core::fmt::write::h77f0ee94152958b8 2: 0x7904d781a603 - std::io::Write::write_fmt::hf6dd3f11ce87ebfd 3: 0x7904d782b922 - std::sys::backtrace::BacktraceLock::print::hf0ee2015b068d272 4: 0x7904d78319f9 - std::panicking::default_hook::{{closure}}::hf66190d472a04973 5: 0x7904d7831523 - std::panicking::default_hook::h214c836e53748476 6: 0x7904d68368e7 - std[d75eede35f95485e]::panicking::update_hook::<alloc[c5f1165681da87d5]::boxed::Box<rustc_driver_impl[483de4215d5a0d3a]::install_ice_hook::{closure#1}>>::{closure#0} 7: 0x7904d7831e1f - std::panicking::panic_with_hook::ha35d30be6548755c 8: 0x7904d7831bda - std::panicking::panic_handler::{{closure}}::hf26b182862a4d512 9: 0x7904d782ba59 - std::sys::backtrace::__rust_end_short_backtrace::hca5b955de0500289 10: 0x7904d780c81d - __rustc[cd85992985178f8b]::rust_begin_unwind 11: 0x7904d47f74e0 - core::panicking::panic_fmt::h39cc62a8520496e4 12: 0x7904d77a43f7 - <rustc_abi[90d1dadb8d98cb9e]::Size as core[e9d4aeab7aaf03ba]::ops::arith::Sub>::sub::{closure#0} 13: 0x7904d77873bb - rustc_target[aea0b2dab06d98f7]::callconv::sparc64::arg_scalar::<rustc_middle[dd66a2b5e7436936]::ty::layout::LayoutCx> 14: 0x7904d7787966 - rustc_target[aea0b2dab06d98f7]::callconv::sparc64::parse_structure::<rustc_middle[dd66a2b5e7436936]::ty::Ty, rustc_middle[dd66a2b5e7436936]::ty::layout::LayoutCx> 15: 0x7904d7787504 - rustc_target[aea0b2dab06d98f7]::callconv::sparc64::classify_arg::<rustc_middle[dd66a2b5e7436936]::ty::Ty, rustc_middle[dd66a2b5e7436936]::ty::layout::LayoutCx> 16: 0x7904d7787ae8 - rustc_target[aea0b2dab06d98f7]::callconv::sparc64::compute_abi_info::<rustc_middle[dd66a2b5e7436936]::ty::Ty, rustc_middle[dd66a2b5e7436936]::ty::layout::LayoutCx> 17: 0x7904d8a9a1fa - rustc_ty_utils[d8e69fb91dd29d5f]::abi::fn_abi_new_uncached 18: 0x7904d8a8b663 - rustc_ty_utils[d8e69fb91dd29d5f]::abi::fn_abi_of_instance 19: 0x7904d8a8ac94 - rustc_query_impl[f50001754b2af376]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f50001754b2af376]::query_impl::fn_abi_of_instance::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dd66a2b5e7436936]::query::erase::Erased<[u8; 16usize]>> 20: 0x7904d8bcf33b - rustc_query_system[42e1b345d4a75a04]::query::plumbing::try_execute_query::<rustc_query_impl[f50001754b2af376]::DynamicConfig<rustc_query_system[42e1b345d4a75a04]::query::caches::DefaultCache<rustc_middle[dd66a2b5e7436936]::ty::PseudoCanonicalInput<(rustc_middle[dd66a2b5e7436936]::ty::instance::Instance, &rustc_middle[dd66a2b5e7436936]::ty::list::RawList<(), rustc_middle[dd66a2b5e7436936]::ty::Ty>)>, rustc_middle[dd66a2b5e7436936]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[f50001754b2af376]::plumbing::QueryCtxt, false> 21: 0x7904d8bceed3 - rustc_query_impl[f50001754b2af376]::query_impl::fn_abi_of_instance::get_query_non_incr::__rust_end_short_backtrace 22: 0x7904d50d8d4e - rustc_monomorphize[4f677f822e948498]::mono_checks::check_mono_item 23: 0x7904d800e4e0 - rustc_query_impl[f50001754b2af376]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f50001754b2af376]::query_impl::check_mono_item::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dd66a2b5e7436936]::query::erase::Erased<[u8; 0usize]>> 24: 0x7904d8c6af4b - rustc_query_system[42e1b345d4a75a04]::query::plumbing::try_execute_query::<rustc_query_impl[f50001754b2af376]::DynamicConfig<rustc_query_system[42e1b345d4a75a04]::query::caches::DefaultCache<rustc_middle[dd66a2b5e7436936]::ty::instance::Instance, rustc_middle[dd66a2b5e7436936]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[f50001754b2af376]::plumbing::QueryCtxt, false> 25: 0x7904d8c6abd1 - rustc_query_impl[f50001754b2af376]::query_impl::check_mono_item::get_query_non_incr::__rust_end_short_backtrace 26: 0x7904d50b200e - rustc_monomorphize[4f677f822e948498]::collector::items_of_instance 27: 0x7904d82d29ca - rustc_query_impl[f50001754b2af376]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f50001754b2af376]::query_impl::items_of_instance::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dd66a2b5e7436936]::query::erase::Erased<[u8; 32usize]>> 28: 0x7904d8a5c395 - rustc_query_system[42e1b345d4a75a04]::query::plumbing::try_execute_query::<rustc_query_impl[f50001754b2af376]::DynamicConfig<rustc_query_system[42e1b345d4a75a04]::query::caches::DefaultCache<(rustc_middle[dd66a2b5e7436936]::ty::instance::Instance, rustc_middle[dd66a2b5e7436936]::mir::mono::CollectionMode), rustc_middle[dd66a2b5e7436936]::query::erase::Erased<[u8; 32usize]>>, false, false, false>, rustc_query_impl[f50001754b2af376]::plumbing::QueryCtxt, false> 29: 0x7904d8a5bfb1 - rustc_query_impl[f50001754b2af376]::query_impl::items_of_instance::get_query_non_incr::__rust_end_short_backtrace 30: 0x7904d8a5e9d7 - rustc_monomorphize[4f677f822e948498]::collector::collect_items_rec::{closure#0} 31: 0x7904d8a5fb3e - rustc_monomorphize[4f677f822e948498]::collector::collect_items_rec 32: 0x7904d827e5e1 - rustc_monomorphize[4f677f822e948498]::collector::collect_crate_mono_items::{closure#1}::{closure#0} 33: 0x7904d86e8638 - rustc_monomorphize[4f677f822e948498]::partitioning::collect_and_partition_mono_items 34: 0x7904d9463164 - rustc_query_impl[f50001754b2af376]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f50001754b2af376]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dd66a2b5e7436936]::query::erase::Erased<[u8; 24usize]>> 35: 0x7904d9463149 - <rustc_query_impl[f50001754b2af376]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core[e9d4aeab7aaf03ba]::ops::function::FnOnce<(rustc_middle[dd66a2b5e7436936]::ty::context::TyCtxt, ())>>::call_once 36: 0x7904d9462ca8 - rustc_query_system[42e1b345d4a75a04]::query::plumbing::try_execute_query::<rustc_query_impl[f50001754b2af376]::DynamicConfig<rustc_query_system[42e1b345d4a75a04]::query::caches::SingleCache<rustc_middle[dd66a2b5e7436936]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[f50001754b2af376]::plumbing::QueryCtxt, false> 37: 0x7904d9462a4d - rustc_query_impl[f50001754b2af376]::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace 38: 0x7904d8d07c71 - rustc_codegen_ssa[16dc2902a2946f7d]::back::symbol_export::exported_generic_symbols_provider_local 39: 0x7904d8e0e575 - rustc_query_impl[f50001754b2af376]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f50001754b2af376]::query_impl::exported_generic_symbols::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dd66a2b5e7436936]::query::erase::Erased<[u8; 16usize]>> 40: 0x7904d8e0e54b - <rustc_query_impl[f50001754b2af376]::query_impl::exported_generic_symbols::dynamic_query::{closure#2} as core[e9d4aeab7aaf03ba]::ops::function::FnOnce<(rustc_middle[dd66a2b5e7436936]::ty::context::TyCtxt, rustc_span[4f3535c5822034d]::def_id::CrateNum)>>::call_once 41: 0x7904d8e0c2a6 - rustc_query_system[42e1b345d4a75a04]::query::plumbing::try_execute_query::<rustc_query_impl[f50001754b2af376]::DynamicConfig<rustc_data_structures[32ba421f28fd0f11]::vec_cache::VecCache<rustc_span[4f3535c5822034d]::def_id::CrateNum, rustc_middle[dd66a2b5e7436936]::query::erase::Erased<[u8; 16usize]>, rustc_query_system[42e1b345d4a75a04]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[f50001754b2af376]::plumbing::QueryCtxt, false> 42: 0x7904d8e0bdcc - rustc_query_impl[f50001754b2af376]::query_impl::exported_generic_symbols::get_query_non_incr::__rust_end_short_backtrace 43: 0x7904d8b1da26 - <rustc_metadata[46f894f4ef43a6bc]::rmeta::encoder::EncodeContext>::encode_crate_root 44: 0x7904d937a70e - <rustc_metadata[46f894f4ef43a6bc]::rmeta::encoder::encode_metadata::{closure#3} as core[e9d4aeab7aaf03ba]::ops::function::FnOnce<(rustc_middle[dd66a2b5e7436936]::ty::context::TyCtxt, &std[d75eede35f95485e]::path::Path)>>::call_once 45: 0x7904d93778d0 - rustc_metadata[46f894f4ef43a6bc]::rmeta::encoder::encode_metadata 46: 0x7904d9034745 - rustc_metadata[46f894f4ef43a6bc]::fs::encode_and_write_metadata 47: 0x7904d935e2e9 - <rustc_interface[dcfd73859d92938d]::queries::Linker>::codegen_and_build_linker 48: 0x7904d935b870 - <rustc_interface[dcfd73859d92938d]::passes::create_and_enter_global_ctxt<core[e9d4aeab7aaf03ba]::option::Option<rustc_interface[dcfd73859d92938d]::queries::Linker>, rustc_driver_impl[483de4215d5a0d3a]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[e9d4aeab7aaf03ba]::ops::function::FnOnce<(&rustc_session[8d2fd3d44d3f439b]::session::Session, rustc_middle[dd66a2b5e7436936]::ty::context::CurrentGcx, alloc[c5f1165681da87d5]::sync::Arc<rustc_data_structures[32ba421f28fd0f11]::jobserver::Proxy>, &std[d75eede35f95485e]::sync::once_lock::OnceLock<rustc_middle[dd66a2b5e7436936]::ty::context::GlobalCtxt>, &rustc_data_structures[32ba421f28fd0f11]::sync::worker_local::WorkerLocal<rustc_middle[dd66a2b5e7436936]::arena::Arena>, &rustc_data_structures[32ba421f28fd0f11]::sync::worker_local::WorkerLocal<rustc_hir[e927335bd4ed3a34]::Arena>, rustc_driver_impl[483de4215d5a0d3a]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0} 49: 0x7904d8fd3f00 - rustc_interface[dcfd73859d92938d]::interface::run_compiler::<(), rustc_driver_impl[483de4215d5a0d3a]::run_compiler::{closure#0}>::{closure#1} 50: 0x7904d9392f09 - std[d75eede35f95485e]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[dcfd73859d92938d]::util::run_in_thread_with_globals<rustc_interface[dcfd73859d92938d]::util::run_in_thread_pool_with_globals<rustc_interface[dcfd73859d92938d]::interface::run_compiler<(), rustc_driver_impl[483de4215d5a0d3a]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> 51: 0x7904d9392bea - <<std[d75eede35f95485e]::thread::Builder>::spawn_unchecked_<rustc_interface[dcfd73859d92938d]::util::run_in_thread_with_globals<rustc_interface[dcfd73859d92938d]::util::run_in_thread_pool_with_globals<rustc_interface[dcfd73859d92938d]::interface::run_compiler<(), rustc_driver_impl[483de4215d5a0d3a]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[e9d4aeab7aaf03ba]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 52: 0x7904d8cf35af - std::sys::thread::unix::Thread::new::thread_start::h262bd1e8192b1475 53: 0x7904d2894ac3 - <unknown> 54: 0x7904d2926850 - <unknown> 55: 0x0 - <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: please make sure that you have updated to the latest nightly note: please attach the file at `/app/rustc-ice-2025-10-19T11_41_08-1.txt` to your bug report note: compiler flags: -C debuginfo=2 -C llvm-args=--x86-asm-syntax=intel --crate-type rlib query stack during panic: #0 [fn_abi_of_instance] computing call ABI of `foo` #1 [check_mono_item] monomorphization-time checking ... and 3 other queries... use `env RUST_BACKTRACE=1` to see the full query stack 

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ABIArea: Concerning the application binary interface (ABI)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️O-SPARCTarget: SPARC processorsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions