Repository navigation
ICE: Offset in NominalSPOffset is greater than 2GB; should hit impl limit first: TryFromIntError(()) #1434
Copy link
Copy link
Open
rust-lang/rust
#119117Labels
C-bugCategory: This is a bug.Category: This is a bug.upstreamCaused by a dependencyCaused by a dependency
Description
auto-reduced (treereduce-rust):
#[repr(align(536870912))]
enum Aligned {
Zero = 0,
One = 1,
}
fn main() {
let aligned = Aligned::Zero;
assert_eq!(tou8(Aligned::Zero), 0);
}
fn tou8(al: Aligned) -> u8 {
al as u8
}
original:
// run-pass
// allows aligned custom discriminant enums to cast into other types
// See the issue #92464 for more info
#[repr(align(536870912))]
#[repr(align(8))]
enum Aligned {
Zero = 0,
One = 1,
}
fn main() {
let aligned = Aligned::Zero;
let fo = aligned as u8;
println!("foo {}", fo);
assert_eq!(fo, 0);
println!("{}", tou8(Aligned::Zero));
assert_eq!(tou8(Aligned::Zero), 0);
}
#[inline(never)]
fn tou8(al: Aligned) -> u8 {
// Cast behind a function call so ConstProp does not see it
// (so that we can test codegen).
al as u8
}Version information
rustc 1.76.0-nightly (d5fab3376 2023-12-02)
binary: rustc
commit-hash: d5fab33766917085588d9bb4fb9477776695d98b
commit-date: 2023-12-02
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.5
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcodegen-backend=cranelift
Program output
warning: unused variable: `aligned`
--> /tmp/icemaker_global_tempdir.IhQoDdu5PZ0P/rustc_testrunner_tmpdir_reporting.orosvbyC2kie/mvce.rs:9:9
|
9 | let aligned = Aligned::Zero;
| ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_aligned`
|
= note: `#[warn(unused_variables)]` on by default
warning: variant `One` is never constructed
--> /tmp/icemaker_global_tempdir.IhQoDdu5PZ0P/rustc_testrunner_tmpdir_reporting.orosvbyC2kie/mvce.rs:5:5
|
3 | enum Aligned {
| ------- variant in this enum
4 | Zero = 0,
5 | One = 1,
| ^^^
|
= note: `#[warn(dead_code)]` on by default
thread '<unnamed>' panicked at /rust/deps/cranelift-codegen-0.102.0/src/isa/x64/abi.rs:957:46:
Offset in NominalSPOffset is greater than 2GB; should hit impl limit first: TryFromIntError(())
stack backtrace:
0: 0x7f5f0f76150c - std::backtrace_rs::backtrace::libunwind::trace::h479849121ff49a5d
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
1: 0x7f5f0f76150c - std::backtrace_rs::backtrace::trace_unsynchronized::hc9644f16de94df45
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f5f0f76150c - std::sys_common::backtrace::_print_fmt::h10290334532192e1
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/std/src/sys_common/backtrace.rs:68:5
3: 0x7f5f0f76150c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1f3df53d81057b3e
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7f5f0f7b4540 - core::fmt::rt::Argument::fmt::hb8e319fcddae9a31
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/core/src/fmt/rt.rs:142:9
5: 0x7f5f0f7b4540 - core::fmt::write::h80be9ea7045f640f
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/core/src/fmt/mod.rs:1120:17
6: 0x7f5f0f75536f - std::io::Write::write_fmt::h0522d22623a1843b
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/std/src/io/mod.rs:1810:15
7: 0x7f5f0f7612f4 - std::sys_common::backtrace::_print::h11954509d6d4a59e
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7f5f0f7612f4 - std::sys_common::backtrace::print::h89028ceab4fa2c56
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7f5f0f763f87 - std::panicking::default_hook::{{closure}}::ha828cf6bd2b63731
10: 0x7f5f0f763cef - std::panicking::default_hook::h85bef85bc0f3798a
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/std/src/panicking.rs:292:9
11: 0x7f5f0c4f9490 - std[be0bda08bb484463]::panicking::update_hook::<alloc[5e2c4fa57d45c172]::boxed::Box<rustc_driver_impl[7a73365881d43582]::install_ice_hook::{closure#0}>>::{closure#0}
12: 0x7f5f0f7646c8 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::he0dee972ea8e9cc9
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/alloc/src/boxed.rs:2021:9
13: 0x7f5f0f7646c8 - std::panicking::rust_panic_with_hook::he9727088864fdef9
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/std/src/panicking.rs:783:13
14: 0x7f5f0f76441e - std::panicking::begin_panic_handler::{{closure}}::h80b7e677079c8e55
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/std/src/panicking.rs:657:13
15: 0x7f5f0f7619d6 - std::sys_common::backtrace::__rust_end_short_backtrace::hd9049e8056407812
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/std/src/sys_common/backtrace.rs:171:18
16: 0x7f5f0f764182 - rust_begin_unwind
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/std/src/panicking.rs:645:5
17: 0x7f5f0f7b0c15 - core::panicking::panic_fmt::h97f53bcafbf77918
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/core/src/panicking.rs:72:14
18: 0x7f5f0f7b1313 - core::result::unwrap_failed::hcb975e08d9c63ed9
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/core/src/result.rs:1649:5
19: 0x7f5f001f559f - <cranelift_codegen[d4c1749a8095538]::isa::x64::abi::X64ABIMachineSpec as cranelift_codegen[d4c1749a8095538]::machinst::abi::ABIMachineSpec>::gen_get_stack_addr
20: 0x7f5f00312548 - cranelift_codegen[d4c1749a8095538]::isa::x64::lower::isle::generated_code::constructor_stack_addr_impl::<cranelift_codegen[d4c1749a8095538]::machinst::isle::IsleContext<cranelift_codegen[d4c1749a8095538]::isa::x64::lower::isle::generated_code::MInst, cranelift_codegen[d4c1749a8095538]::isa::x64::X64Backend>>
21: 0x7f5f003144f9 - cranelift_codegen[d4c1749a8095538]::isa::x64::lower::isle::generated_code::constructor_lower::<cranelift_codegen[d4c1749a8095538]::machinst::isle::IsleContext<cranelift_codegen[d4c1749a8095538]::isa::x64::lower::isle::generated_code::MInst, cranelift_codegen[d4c1749a8095538]::isa::x64::X64Backend>>
22: 0x7f5f0015a807 - <cranelift_codegen[d4c1749a8095538]::machinst::lower::Lower<cranelift_codegen[d4c1749a8095538]::isa::x64::lower::isle::generated_code::MInst>>::lower::<cranelift_codegen[d4c1749a8095538]::isa::x64::X64Backend>
23: 0x7f5f00195cad - cranelift_codegen[d4c1749a8095538]::machinst::compile::compile::<cranelift_codegen[d4c1749a8095538]::isa::x64::X64Backend>
24: 0x7f5f00249a3a - <cranelift_codegen[d4c1749a8095538]::isa::x64::X64Backend as cranelift_codegen[d4c1749a8095538]::isa::TargetIsa>::compile_function
25: 0x7f5f002d68cd - <cranelift_codegen[d4c1749a8095538]::context::Context>::compile_stencil
26: 0x7f5f002d65b7 - <cranelift_codegen[d4c1749a8095538]::context::Context>::compile_and_emit
27: 0x7f5f0006bf00 - <cranelift_object[d66c271104bc3a81]::backend::ObjectModule as cranelift_module[4cf4b873220cd41]::module::Module>::define_function_with_control_plane
28: 0x7f5f00025ef2 - rustc_codegen_cranelift[b6b6b84571df3c3b]::driver::aot::module_codegen::{closure#1}
29: 0x7f5efffc2a16 - std[be0bda08bb484463]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_codegen_cranelift[b6b6b84571df3c3b]::driver::aot::module_codegen::{closure#1}, core[9199d425737c1d72]::result::Result<rustc_codegen_cranelift[b6b6b84571df3c3b]::driver::aot::ModuleCodegenResult, alloc[5e2c4fa57d45c172]::string::String>>
30: 0x7f5efffd1616 - <<std[be0bda08bb484463]::thread::Builder>::spawn_unchecked_<rustc_codegen_cranelift[b6b6b84571df3c3b]::driver::aot::module_codegen::{closure#1}, core[9199d425737c1d72]::result::Result<rustc_codegen_cranelift[b6b6b84571df3c3b]::driver::aot::ModuleCodegenResult, alloc[5e2c4fa57d45c172]::string::String>>::{closure#1} as core[9199d425737c1d72]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
31: 0x7f5f0f76e555 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h97e5c9d6b1622657
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/alloc/src/boxed.rs:2007:9
32: 0x7f5f0f76e555 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb5f6014336ba501b
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/alloc/src/boxed.rs:2007:9
33: 0x7f5f0f76e555 - std::sys::unix::thread::Thread::new::thread_start::h758e18463c2780d9
at /rustc/d5fab33766917085588d9bb4fb9477776695d98b/library/std/src/sys/unix/thread.rs:108:17
34: 0x7f5f096a59eb - <unknown>
35: 0x7f5f097297cc - <unknown>
36: 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: rustc 1.76.0-nightly (d5fab3376 2023-12-02) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z codegen-backend=cranelift -Z dump-mir-dir=dir
query stack during panic:
end of query stack
warning: 2 warnings emitted
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.upstreamCaused by a dependencyCaused by a dependency
Activity
[-]ICE: `Offset in NominalSPOffset is greater than 2GB; should hit impl limit first: TryFromIntError(())[/-][+]ICE: `Offset in NominalSPOffset is greater than 2GB; should hit impl limit first: TryFromIntError(())`[/+]bjorn3 commentedon Dec 3, 2023
This is a Cranelift bug. It should propagate the error out into cg_clif, which would then give a rustc diagnostic for this. Cranelift doesn't support stack frames larger than 2GB. (Neither does LLVM, but LLVM tends to silently miscompile instead)
bjorn3 commentedon Dec 18, 2023
I can't reproduce this with the latest version in this repo.
matthiaskrgr commentedon Dec 18, 2023
Seems to be fixed, indeed.
bjorn3 commentedon Dec 19, 2023
Should be fixed on the next nightly then.
matthiaskrgr commentedon Feb 11, 2024
@bjorn3 this is crashing again it seems.
matthiaskrgr commentedon Feb 11, 2024
Regression in nightly-2024-02-11
ending github query because we found starting sha: d44e3b95cb9d410d89cb8ab3233906a33f43756a
get_commits_between returning commits, len: 7
commit[0] 2024-02-09: Auto merge of #120852 - matthiaskrgr:rollup-01pr8gj, r=matthiaskrgr
commit[1] 2024-02-10: Auto merge of #120862 - matthiaskrgr:rollup-jzfab58, r=matthiaskrgr
commit[2] 2024-02-10: Auto merge of #120721 - onur-ozkan:incorrect-llvm-path-on-cross-target, r=albertlarsan68
commit[3] 2024-02-10: Auto merge of #120712 - compiler-errors:async-closures-harmonize, r=oli-obk
commit[4] 2024-02-10: Auto merge of #120771 - oli-obk:useless_non_ensure_query_call, r=davidtwco
commit[5] 2024-02-10: Auto merge of #120877 - matthiaskrgr:rollup-j1b8mv6, r=matthiaskrgr
commit[6] 2024-02-10: Auto merge of #119614 - RalfJung:const-refs-to-static, r=oli-obk
bjorn3 commentedon Feb 11, 2024
Is it panicking with the same message?
matthiaskrgr commentedon Feb 11, 2024
Yeah, as if the original fix had been reverted or something :|
bjorn3 commentedon Feb 12, 2024
I can't reproduce this with
rustc +nightly-2024-02-12 src/main.rs -Zcodegen-backend=craneliftwheresrc/main.rsis:matthiaskrgr commentedon Feb 12, 2024
weird.
for me:
so the only diff I can spot right now is that I'm on
x86and you're onaarch64, could that make a difference?Edit: the backtrace also goes through some x86 stuff
/rust/deps/cranelift-codegen-0.104.0/src/isa/x64/abi.rs:957:46:bjorn3 commentedon Feb 12, 2024
Of course. Will test on x86 in a bit.
bjorn3 commentedon Feb 12, 2024
On x86 cargo-bisect-rustc for me can't find any nightly for which it actually worked. Even manually checking a random nightly for which it should have worked (nightly-2023-12-31) it gives the same ICE. And with the latest version in this repo it fails too. Maybe I checked it on aarch64 back then too?
matthiaskrgr commentedon Jan 1, 2025
Probably the same issue:
auto-reduced (treereduce-rust):
original:
Version information
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --cap-lints=warn -Zcodegen-backend=craneliftProgram output