Skip to content

ICE: cfi: None with extern "C" fn .. -> #[repr(transparent) #114275

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

rustc -Clto -Zsanitizer=cfi treereduce.out

#![crate_type = "lib"]

#[repr(transparent)]
pub struct WithZeroSizedArray([u8; 64 * 3]);

pub extern "C" fn test_WithZeroSizedArray() -> WithZeroSizedArray {
    loop {}
}

Meta

rustc --version --verbose:

rustc 1.73.0-nightly (32303b219 2023-07-29)
binary: rustc
commit-hash: 32303b219d4dffa447aa606bc11c7a648f44a862
commit-date: 2023-07-29
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

Error output

<output>
Backtrace

warning: function `test_WithZeroSizedArray` should have a snake case name
 --> treereduce.out:6:19
  |
6 | pub extern "C" fn test_WithZeroSizedArray() -> WithZeroSizedArray {
  |                   ^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `test_with_zero_sized_array`
  |
  = note: `#[warn(non_snake_case)]` on by default

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs:829:18
stack backtrace:
   0:     0x7f1fa0bd5fc1 - std::backtrace_rs::backtrace::libunwind::trace::he692921cd71061da
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f1fa0bd5fc1 - std::backtrace_rs::backtrace::trace_unsynchronized::h268323222e8c1ab8
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f1fa0bd5fc1 - std::sys_common::backtrace::_print_fmt::haee60c61afbc4ed3
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f1fa0bd5fc1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd36c36e4b57d240a
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f1fa0c3c49c - core::fmt::rt::Argument::fmt::h0bae45bdae59332b
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/core/src/fmt/rt.rs:138:9
   5:     0x7f1fa0c3c49c - core::fmt::write::h1eff66863ae03e81
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f1fa0bc85ce - std::io::Write::write_fmt::h0b1eac3a638eca57
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/io/mod.rs:1714:15
   7:     0x7f1fa0bd5dd5 - std::sys_common::backtrace::_print::h55c2e79c6c43fc91
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f1fa0bd5dd5 - std::sys_common::backtrace::print::ha1cd10f2ad29b00d
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f1fa0bd8e2a - std::panicking::panic_hook_with_disk_dump::{{closure}}::h1c11dff971492549
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/panicking.rs:278:22
  10:     0x7f1fa0bd8ac3 - std::panicking::panic_hook_with_disk_dump::hffdc434b289dce74
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/panicking.rs:312:9
  11:     0x7f1f9fa17f39 - rustc_driver_impl[2f0949cc27d93100]::install_ice_hook::{closure#0}
  12:     0x7f1fa0bd96d0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h85e1510843a93c91
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/alloc/src/boxed.rs:2021:9
  13:     0x7f1fa0bd96d0 - std::panicking::rust_panic_with_hook::hf537c3fb4549c7ab
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/panicking.rs:733:13
  14:     0x7f1fa0bd9411 - std::panicking::begin_panic_handler::{{closure}}::h8791939d8094656c
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/panicking.rs:619:13
  15:     0x7f1fa0bd6426 - std::sys_common::backtrace::__rust_end_short_backtrace::h97d7186112a2730d
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/sys_common/backtrace.rs:151:18
  16:     0x7f1fa0bd91a2 - rust_begin_unwind
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/panicking.rs:617:5
  17:     0x7f1fa0c38853 - core::panicking::panic_fmt::h20b5a24907eb9152
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/core/src/panicking.rs:67:14
  18:     0x7f1fa0c388e3 - core::panicking::panic::h25004e7860913ecd
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/core/src/panicking.rs:117:5
  19:     0x7f1fa04d28d6 - rustc_symbol_mangling[f6bfc9484dc7d803]::typeid::typeid_itanium_cxx_abi::transform_ty
  20:     0x7f1fa04d28b8 - rustc_symbol_mangling[f6bfc9484dc7d803]::typeid::typeid_itanium_cxx_abi::transform_ty
  21:     0x7f1fa04d378f - rustc_symbol_mangling[f6bfc9484dc7d803]::typeid::typeid_itanium_cxx_abi::typeid_for_fnabi
  22:     0x7f1fa04d2e37 - rustc_symbol_mangling[f6bfc9484dc7d803]::typeid::typeid_itanium_cxx_abi::typeid_for_instance
  23:     0x7f1f9e208167 - <rustc_codegen_llvm[298d1cca842a1aab]::context::CodegenCx as rustc_codegen_ssa[cb9c33fd3c1c804a]::traits::declare::PreDefineMethods>::predefine_fn
  24:     0x7f1f9eb864ec - rustc_codegen_llvm[298d1cca842a1aab]::base::compile_codegen_unit::module_codegen
  25:     0x7f1f9eb84299 - rustc_codegen_llvm[298d1cca842a1aab]::base::compile_codegen_unit
  26:     0x7f1f9eb808c1 - rustc_codegen_ssa[cb9c33fd3c1c804a]::base::codegen_crate::<rustc_codegen_llvm[298d1cca842a1aab]::LlvmCodegenBackend>
  27:     0x7f1f9eb802cb - <rustc_codegen_llvm[298d1cca842a1aab]::LlvmCodegenBackend as rustc_codegen_ssa[cb9c33fd3c1c804a]::traits::backend::CodegenBackend>::codegen_crate
  28:     0x7f1f9ec94322 - <rustc_session[7caa4c3ec0f6dde7]::session::Session>::time::<alloc[3f9bbb105762381e]::boxed::Box<dyn core[7c3dc332a8e1c229]::any::Any>, rustc_interface[3259f0f1c0f54e17]::passes::start_codegen::{closure#0}>
  29:     0x7f1f9ec93e9b - rustc_interface[3259f0f1c0f54e17]::passes::start_codegen
  30:     0x7f1f9ec8eb2a - <rustc_middle[e8d608d57e197328]::ty::context::GlobalCtxt>::enter::<<rustc_interface[3259f0f1c0f54e17]::queries::Queries>::ongoing_codegen::{closure#0}, core[7c3dc332a8e1c229]::result::Result<alloc[3f9bbb105762381e]::boxed::Box<dyn core[7c3dc332a8e1c229]::any::Any>, rustc_span[3261ff60f64e7044]::ErrorGuaranteed>>
  31:     0x7f1f9ec8db63 - <rustc_interface[3259f0f1c0f54e17]::interface::Compiler>::enter::<rustc_driver_impl[2f0949cc27d93100]::run_compiler::{closure#1}::{closure#2}, core[7c3dc332a8e1c229]::result::Result<core[7c3dc332a8e1c229]::option::Option<rustc_interface[3259f0f1c0f54e17]::queries::Linker>, rustc_span[3261ff60f64e7044]::ErrorGuaranteed>>
  32:     0x7f1f9ec86bb8 - std[ec332d703e613242]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3259f0f1c0f54e17]::util::run_in_thread_pool_with_globals<rustc_interface[3259f0f1c0f54e17]::interface::run_compiler<core[7c3dc332a8e1c229]::result::Result<(), rustc_span[3261ff60f64e7044]::ErrorGuaranteed>, rustc_driver_impl[2f0949cc27d93100]::run_compiler::{closure#1}>::{closure#0}, core[7c3dc332a8e1c229]::result::Result<(), rustc_span[3261ff60f64e7044]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7c3dc332a8e1c229]::result::Result<(), rustc_span[3261ff60f64e7044]::ErrorGuaranteed>>
  33:     0x7f1f9ec8633e - <<std[ec332d703e613242]::thread::Builder>::spawn_unchecked_<rustc_interface[3259f0f1c0f54e17]::util::run_in_thread_pool_with_globals<rustc_interface[3259f0f1c0f54e17]::interface::run_compiler<core[7c3dc332a8e1c229]::result::Result<(), rustc_span[3261ff60f64e7044]::ErrorGuaranteed>, rustc_driver_impl[2f0949cc27d93100]::run_compiler::{closure#1}>::{closure#0}, core[7c3dc332a8e1c229]::result::Result<(), rustc_span[3261ff60f64e7044]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7c3dc332a8e1c229]::result::Result<(), rustc_span[3261ff60f64e7044]::ErrorGuaranteed>>::{closure#1} as core[7c3dc332a8e1c229]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:     0x7f1fa0be3dc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc5b9f463e020ec3e
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/alloc/src/boxed.rs:2007:9
  35:     0x7f1fa0be3dc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h140e20c91de13bb4
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/alloc/src/boxed.rs:2007:9
  36:     0x7f1fa0be3dc5 - std::sys::unix::thread::Thread::new::thread_start::hfad7ee6626cdd5ae
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/sys/unix/thread.rs:108:17
  37:     0x7f1f9c66444b - <unknown>
  38:     0x7f1f9c6e7e40 - <unknown>
  39:                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/im/rustc-ice-2023-07-31T05:52:09.80874732Z-953248.txt` to your bug report

note: compiler flags: -C lto -Z sanitizer=cfi

query stack during panic:
end of query stack
warning: 1 warning emitted

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️PG-exploit-mitigationsProject group: Exploit mitigationsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions