Skip to content

ICE: Offset in NominalSPOffset is greater than 2GB; should hit impl limit first: TryFromIntError(()) #1434

Open
rust-lang/rust
#119117

Description

@matthiaskrgr

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


Activity

  1. changed the title [-]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(())`[/+] on Dec 3, 2023
  2. added
    C-bugCategory: This is a bug.
    upstreamCaused by a dependency
    on Dec 3, 2023
  3. bjorn3 commented on Dec 3, 2023

    @bjorn3
    Member

    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)

  4. bjorn3 commented on Dec 18, 2023

    @bjorn3
    Member

    I can't reproduce this with the latest version in this repo.

  5. matthiaskrgr commented on Dec 18, 2023

    @matthiaskrgr
    MemberAuthor

    Seems to be fixed, indeed.

  6. linked a pull request that will close this issueSubtree sync for rustc_codegen_cranelift #119117on Dec 19, 2023
  7. bjorn3 commented on Dec 19, 2023

    @bjorn3
    Member

    Should be fixed on the next nightly then.

  8. matthiaskrgr commented on Feb 11, 2024

    @matthiaskrgr
    MemberAuthor

    @bjorn3 this is crashing again it seems.

  9. matthiaskrgr commented on Feb 11, 2024

    @matthiaskrgr
    MemberAuthor

    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

  10. bjorn3 commented on Feb 11, 2024

    @bjorn3
    Member

    Is it panicking with the same message?

  11. reopened this on Feb 11, 2024
  12. matthiaskrgr commented on Feb 11, 2024

    @matthiaskrgr
    MemberAuthor

    Yeah, as if the original fix had been reverted or something :|

    at 21:38:22 ❯ ~/.rustup/toolchains/master/bin/rustc cl.rs -Zcodegen-backend=cranelift
    warning: unused variable: `aligned`
     --> cl.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
     --> cl.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.104.0/src/isa/x64/abi.rs:957:46:
    Offset in NominalSPOffset is greater than 2GB; should hit impl limit first: TryFromIntError(())
    stack backtrace:
       0:     0x7fe584768416 - std::backtrace_rs::backtrace::libunwind::trace::he5e0c8035bcf370a
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
       1:     0x7fe584768416 - std::backtrace_rs::backtrace::trace_unsynchronized::hba9faf93820c49a0
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
       2:     0x7fe584768416 - std::sys_common::backtrace::_print_fmt::hd96a65dc4519c6a2
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/std/src/sys_common/backtrace.rs:68:5
       3:     0x7fe584768416 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1e43ea967dd08c60
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/std/src/sys_common/backtrace.rs:44:22
       4:     0x7fe5847baf90 - core::fmt::rt::Argument::fmt::h7d139ffbc6561f88
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/core/src/fmt/rt.rs:142:9
       5:     0x7fe5847baf90 - core::fmt::write::h1bb9a6b0afdc200a
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/core/src/fmt/mod.rs:1120:17
       6:     0x7fe58475bc9f - std::io::Write::write_fmt::hce12a9b2d6e999ce
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/std/src/io/mod.rs:1854:15
       7:     0x7fe5847681f4 - std::sys_common::backtrace::_print::h617917b22169e3a6
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/std/src/sys_common/backtrace.rs:47:5
       8:     0x7fe5847681f4 - std::sys_common::backtrace::print::h8e043c0f1534c736
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/std/src/sys_common/backtrace.rs:34:9
       9:     0x7fe58476afe7 - std::panicking::default_hook::{{closure}}::h7e3fb3ae3c6c108e
      10:     0x7fe58476ad49 - std::panicking::default_hook::h55b5e261b40d6db7
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/std/src/panicking.rs:292:9
      11:     0x7fe58154d15c - std[b3f5a7d6316481fd]::panicking::update_hook::<alloc[49d4571b2a6eb602]::boxed::Box<rustc_driver_impl[2740d49934284c30]::install_ice_hook::{closure#0}>>::{closure#0}
      12:     0x7fe58476b736 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h4a73ab022c7efc08
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/alloc/src/boxed.rs:2030:9
      13:     0x7fe58476b736 - std::panicking::rust_panic_with_hook::h625291f242c593a2
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/std/src/panicking.rs:785:13
      14:     0x7fe58476b482 - std::panicking::begin_panic_handler::{{closure}}::h2ad2d559889c7088
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/std/src/panicking.rs:659:13
      15:     0x7fe584768916 - std::sys_common::backtrace::__rust_end_short_backtrace::h97f79d64397675a6
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/std/src/sys_common/backtrace.rs:171:18
      16:     0x7fe58476b1d4 - rust_begin_unwind
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/std/src/panicking.rs:647:5
      17:     0x7fe5847b76e5 - core::panicking::panic_fmt::h8e3943f3224f5dc8
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/core/src/panicking.rs:72:14
      18:     0x7fe5847b7d93 - core::result::unwrap_failed::hf90562567199e58f
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/core/src/result.rs:1653:5
      19:     0x7fe574ff421f - <cranelift_codegen[2b9ae455c3dcf26c]::isa::x64::abi::X64ABIMachineSpec as cranelift_codegen[2b9ae455c3dcf26c]::machinst::abi::ABIMachineSpec>::gen_get_stack_addr
      20:     0x7fe57510f458 - cranelift_codegen[2b9ae455c3dcf26c]::isa::x64::lower::isle::generated_code::constructor_stack_addr_impl::<cranelift_codegen[2b9ae455c3dcf26c]::machinst::isle::IsleContext<cranelift_codegen[2b9ae455c3dcf26c]::isa::x64::lower::isle::generated_code::MInst, cranelift_codegen[2b9ae455c3dcf26c]::isa::x64::X64Backend>>
      21:     0x7fe575111224 - cranelift_codegen[2b9ae455c3dcf26c]::isa::x64::lower::isle::generated_code::constructor_lower::<cranelift_codegen[2b9ae455c3dcf26c]::machinst::isle::IsleContext<cranelift_codegen[2b9ae455c3dcf26c]::isa::x64::lower::isle::generated_code::MInst, cranelift_codegen[2b9ae455c3dcf26c]::isa::x64::X64Backend>>
      22:     0x7fe574f5aaa8 - <cranelift_codegen[2b9ae455c3dcf26c]::machinst::lower::Lower<cranelift_codegen[2b9ae455c3dcf26c]::isa::x64::lower::isle::generated_code::MInst>>::lower::<cranelift_codegen[2b9ae455c3dcf26c]::isa::x64::X64Backend>
      23:     0x7fe574f959e6 - cranelift_codegen[2b9ae455c3dcf26c]::machinst::compile::compile::<cranelift_codegen[2b9ae455c3dcf26c]::isa::x64::X64Backend>
      24:     0x7fe5750476cf - <cranelift_codegen[2b9ae455c3dcf26c]::isa::x64::X64Backend as cranelift_codegen[2b9ae455c3dcf26c]::isa::TargetIsa>::compile_function
      25:     0x7fe5750d478d - <cranelift_codegen[2b9ae455c3dcf26c]::context::Context>::compile_stencil
      26:     0x7fe5750d4487 - <cranelift_codegen[2b9ae455c3dcf26c]::context::Context>::compile_and_emit
      27:     0x7fe574e6eb67 - <cranelift_object[37b74b9f6be5a183]::backend::ObjectModule as cranelift_module[c340c0629507e123]::module::Module>::define_function_with_control_plane
      28:     0x7fe574e281ed - rustc_codegen_cranelift[30aa422767537c2c]::driver::aot::module_codegen::{closure#1}
      29:     0x7fe574dc6586 - std[b3f5a7d6316481fd]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_codegen_cranelift[30aa422767537c2c]::driver::aot::module_codegen::{closure#1}, core[6b66d21a0b634bc5]::result::Result<rustc_codegen_cranelift[30aa422767537c2c]::driver::aot::ModuleCodegenResult, alloc[49d4571b2a6eb602]::string::String>>
      30:     0x7fe574dd48e5 - <<std[b3f5a7d6316481fd]::thread::Builder>::spawn_unchecked_<rustc_codegen_cranelift[30aa422767537c2c]::driver::aot::module_codegen::{closure#1}, core[6b66d21a0b634bc5]::result::Result<rustc_codegen_cranelift[30aa422767537c2c]::driver::aot::ModuleCodegenResult, alloc[49d4571b2a6eb602]::string::String>>::{closure#1} as core[6b66d21a0b634bc5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
      31:     0x7fe584774925 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h42b8a5efac338fd6
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/alloc/src/boxed.rs:2016:9
      32:     0x7fe584774925 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd13625d7c61bd598
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/alloc/src/boxed.rs:2016:9
      33:     0x7fe584774925 - std::sys::pal::unix::thread::Thread::new::thread_start::hbab9c5508e05c622
                                   at /rustc/a166af7729d6f4e6570918701f79dfae750a00c4/library/std/src/sys/pal/unix/thread.rs:108:17
      34:     0x7fe57e66a9eb - <unknown>
      35:     0x7fe57e6ee7cc - <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: please attach the file at `/tmp/rustc-ice-2024-02-11T20_38_29-2225644.txt` to your bug report
    
    note: compiler flags: -Z codegen-backend=cranelift
    
    query stack during panic:
    end of query stack
    warning: 2 warnings emitted
    
    /tmp via 🦀 v1.78.0-nightly
    at 21:39:32 ❯ ~/.rustup/toolchains/master/bin/rustc --version
    rustc 1.78.0-nightly (a166af772 2024-02-11)
    /tmp via 🦀 v1.78.0-nightly
    
  13. bjorn3 commented on Feb 12, 2024

    @bjorn3
    Member

    I can't reproduce this with rustc +nightly-2024-02-12 src/main.rs -Zcodegen-backend=cranelift where src/main.rs is:

    #[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
    }
    $ rustc -vV -Zcodegen-backend=cranelift
    rustc 1.78.0-nightly (1a648b397 2024-02-11)
    binary: rustc
    commit-hash: 1a648b397dedc98ada3dd3360f6d661ec2436c56
    commit-date: 2024-02-11
    host: aarch64-unknown-linux-gnu
    release: 1.78.0-nightly
    Cranelift version: 0.104.0
    
  14. matthiaskrgr commented on Feb 12, 2024

    @matthiaskrgr
    MemberAuthor

    weird.
    for me:

    rustc 1.78.0-nightly (1a648b397 2024-02-11)
    binary: rustc
    commit-hash: 1a648b397dedc98ada3dd3360f6d661ec2436c56
    commit-date: 2024-02-11
    host: x86_64-unknown-linux-gnu
    release: 1.78.0-nightly
    Cranelift version: 0.104.0
    

    so the only diff I can spot right now is that I'm on x86 and you're on aarch64, 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:

  15. bjorn3 commented on Feb 12, 2024

    @bjorn3
    Member

    Of course. Will test on x86 in a bit.

  16. bjorn3 commented on Feb 12, 2024

    @bjorn3
    Member

    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?

  17. matthiaskrgr commented on Jan 1, 2025

    @matthiaskrgr
    MemberAuthor

    Probably the same issue:

    auto-reduced (treereduce-rust):

    //@compile-flags: --cap-lints=warn -Zcodegen-backend=cranelift
    pub fn main() {
        let x = [1; 0x3f800000];
        let mut y = 0;
        for i in &x[..] {
            y += *i
        }
    }

    original:

    //@ run-pass
    
    pub fn main() {
        let x = [1; 0x3f800000];
        let mut y = 0;
        for i in &x[..] {
            y += *i
        }
        assert_eq!(y, 0xbf7fffff);
    }

    Version information

    rustc 1.85.0-nightly (45d11e51b 2025-01-01)
    binary: rustc
    commit-hash: 45d11e51bb66c2deb63a006fe3953c4b6fbc50c2
    commit-date: 2025-01-01
    host: x86_64-unknown-linux-gnu
    release: 1.85.0-nightly
    LLVM version: 19.1.6
    
    

    Command:
    /home/matthias/.rustup/toolchains/master/bin/rustc --cap-lints=warn -Zcodegen-backend=cranelift

    Program output

    warning: variable `y` is assigned to, but never used
     --> /tmp/icemaker_global_tempdir.h3aAmVnX9DUg/rustc_testrunner_tmpdir_reporting.wY8L77Hfkync/mvce.rs:3:13
      |
    3 |     let mut y = 0;
      |             ^
      |
      = note: consider using `_y` instead
      = note: `#[warn(unused_variables)]` on by default
    
    thread '<unnamed>' panicked at /rust/deps/cranelift-codegen-0.114.0/src/isa/x64/abi.rs:1050:22:
    Offset in Slot is greater than 2GB; should hit impl limit first: TryFromIntError(())
    stack backtrace:
       0:     0x77babecd196a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h4f6a4ee866651707
       1:     0x77babf413426 - core::fmt::write::h9e6f8d90343a57f6
       2:     0x77bac0330991 - std::io::Write::write_fmt::h66c66b1419a58ace
       3:     0x77babecd17c2 - std::sys::backtrace::BacktraceLock::print::h498d080cb25470cd
       4:     0x77babecd3cc9 - std::panicking::default_hook::{{closure}}::hbbfe0167a7d38133
       5:     0x77babecd3b12 - std::panicking::default_hook::h9a3de122a21c6cbb
       6:     0x77babde42398 - std[8bfb91823dd31ae1]::panicking::update_hook::<alloc[6d3b84562c9c9b42]::boxed::Box<rustc_driver_impl[a4f26dc2be1bc8fc]::install_ice_hook::{closure#1}>>::{closure#0}
       7:     0x77babecd4483 - std::panicking::rust_panic_with_hook::hce10802d9af4ae90
       8:     0x77babecd417a - std::panicking::begin_panic_handler::{{closure}}::h970170fe06df4228
       9:     0x77babecd1e19 - std::sys::backtrace::__rust_end_short_backtrace::hc705fc339aff58b7
      10:     0x77babecd3e3d - rust_begin_unwind
      11:     0x77babb99ccc0 - core::panicking::panic_fmt::h9cbd0b9e37a0849d
      12:     0x77babbe2eb16 - core::result::unwrap_failed::h507902d6dd0f7c52
      13:     0x77bab021c132 - <cranelift_codegen[81c09a9af8133a0e]::isa::x64::abi::X64ABIMachineSpec as cranelift_codegen[81c09a9af8133a0e]::machinst::abi::ABIMachineSpec>::gen_get_stack_addr
      14:     0x77bab0308f91 - cranelift_codegen[81c09a9af8133a0e]::isa::x64::lower::isle::generated_code::constructor_stack_addr_impl::<cranelift_codegen[81c09a9af8133a0e]::machinst::isle::IsleContext<cranelift_codegen[81c09a9af8133a0e]::isa::x64::lower::isle::generated_code::MInst, cranelift_codegen[81c09a9af8133a0e]::isa::x64::X64Backend>>
      15:     0x77bab030add0 - cranelift_codegen[81c09a9af8133a0e]::isa::x64::lower::isle::generated_code::constructor_lower::<cranelift_codegen[81c09a9af8133a0e]::machinst::isle::IsleContext<cranelift_codegen[81c09a9af8133a0e]::isa::x64::lower::isle::generated_code::MInst, cranelift_codegen[81c09a9af8133a0e]::isa::x64::X64Backend>>
      16:     0x77bab019202b - <cranelift_codegen[81c09a9af8133a0e]::machinst::lower::Lower<cranelift_codegen[81c09a9af8133a0e]::isa::x64::lower::isle::generated_code::MInst>>::lower::<cranelift_codegen[81c09a9af8133a0e]::isa::x64::X64Backend>
      17:     0x77bab01c431c - cranelift_codegen[81c09a9af8133a0e]::machinst::compile::compile::<cranelift_codegen[81c09a9af8133a0e]::isa::x64::X64Backend>
      18:     0x77bab0249f91 - <cranelift_codegen[81c09a9af8133a0e]::isa::x64::X64Backend as cranelift_codegen[81c09a9af8133a0e]::isa::TargetIsa>::compile_function
      19:     0x77bab02ccd55 - <cranelift_codegen[81c09a9af8133a0e]::context::Context>::compile_stencil
      20:     0x77bab02cd690 - <cranelift_codegen[81c09a9af8133a0e]::context::Context>::compile
      21:     0x77bab0096471 - <cranelift_object[86c86d82d739ef53]::backend::ObjectModule as cranelift_module[e8d44bedc8eb427d]::module::Module>::define_function_with_control_plane
      22:     0x77bab0058d6e - rustc_codegen_cranelift[ac7d535e3f93ff01]::driver::aot::module_codegen::{closure#0}
      23:     0x77baaffec299 - std[8bfb91823dd31ae1]::sys::backtrace::__rust_begin_short_backtrace::<rustc_codegen_cranelift[ac7d535e3f93ff01]::driver::aot::module_codegen::{closure#0}, core[d95970c0d684ac01]::result::Result<rustc_codegen_cranelift[ac7d535e3f93ff01]::driver::aot::ModuleCodegenResult, alloc[6d3b84562c9c9b42]::string::String>>
      24:     0x77baafff5c83 - <<std[8bfb91823dd31ae1]::thread::Builder>::spawn_unchecked_<rustc_codegen_cranelift[ac7d535e3f93ff01]::driver::aot::module_codegen::{closure#0}, core[d95970c0d684ac01]::result::Result<rustc_codegen_cranelift[ac7d535e3f93ff01]::driver::aot::ModuleCodegenResult, alloc[6d3b84562c9c9b42]::string::String>>::{closure#1} as core[d95970c0d684ac01]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
      25:     0x77bac03002ef - std::sys::pal::unix::thread::Thread::new::thread_start::hf62fdb37efc5763b
      26:     0x77baba6a339d - <unknown>
      27:     0x77baba72849c - <unknown>
      28:                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: rustc 1.85.0-nightly (45d11e51b 2025-01-01) 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: 1 warning emitted
    
    
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.upstreamCaused by a dependency

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions