Skip to content

Compiler ICE with custom target - string translation missing? #112928

Closed
@jonathanpallant

Description

@jonathanpallant

Code

#![no_std]
#![no_main]

use core::panic::PanicInfo;

#[no_mangle]
extern "C" fn main() {
    loop {}
}

#[panic_handler]
fn panic(_panic: &PanicInfo<'_>) -> ! {
    loop {}
}

sparc-unknown-none.json:

{
  "arch": "sparc",
  "cpu": "leon3",
  "data-layout": "E-m:e-p:32:32-i64:64-f128:64-n32-S64",
  "emit-debug-gdb-scripts": false,
  "is-builtin": false,
  "linker": "rust-lld",
  "linker-flavor": "ld.lld",
  "llvm-target": "sparc-unknown-none",
  "max-atomic-width": 64,
  "panic-strategy": "abort",
  "relocation-model": "static",
  "target-pointer-width": "32"
}

My target spec may be bogus, but I shouldn't be able to crash the compiler with it.

Meta

rustc --version --verbose:

rustc 1.72.0-nightly (46514218f 2023-06-20)
binary: rustc
commit-hash: 46514218f6f31ad3a1510ecc32af47e9e486c27d
commit-date: 2023-06-20
host: aarch64-apple-darwin
release: 1.72.0-nightly
LLVM version: 16.0.5

Error output

error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/Users/jonathan/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/rustc - --crate-name ___ --print=file-names --target /Users/jonathan/Documents/ferrous-systems/demos/sparc-test/sparc-unknown-none.json --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 101)
  --- stderr
  thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: failed while formatting fluent string `errors_target_inconsistent_architecture`:
  message was missing
  ', compiler/rustc_errors/src/emitter.rs:1402:84
  stack backtrace:
     0:        0x104af8170 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb3e5da6e68fd5c2e
     1:        0x104b4877c - core::fmt::write::heb309e144bc6ae4a
     2:        0x104aedb10 - std::io::Write::write_fmt::hea4eceee9c4bdb84
     3:        0x104af7fc8 - std::sys_common::backtrace::print::h3d94f3acf0bf4ba3
     4:        0x104afab44 - std::panicking::default_hook::{{closure}}::h0849540217fba12c
     5:        0x104afa8d4 - std::panicking::default_hook::hb9fcf96bd02d5b9e
     6:        0x10d07ee68 - rustc_driver_impl[e7720fb4bb534f5a]::install_ice_hook::{closure#0}
     7:        0x104afb2c4 - std::panicking::rust_panic_with_hook::h74c053c4cc8fe65c
     8:        0x104afb098 - std::panicking::begin_panic_handler::{{closure}}::hf6b9b5291fb20dba
     9:        0x104af8550 - std::sys_common::backtrace::__rust_end_short_backtrace::h8573d0aaaea910db
    10:        0x104afae04 - _rust_begin_unwind
    11:        0x104b73944 - core::panicking::panic_fmt::h9204a63f051b72ff
    12:        0x104b73d04 - core::result::unwrap_failed::hef34e719c016afa6
    13:        0x11102ad80 - <rustc_errors[d432632eb53fae67]::emitter::EmitterWriter>::emit_message_default::{closure#0}
    14:        0x11102b29c - <rustc_errors[d432632eb53fae67]::emitter::EmitterWriter>::emit_messages_default
    15:        0x111021b60 - <rustc_errors[d432632eb53fae67]::emitter::EmitterWriter as rustc_errors[d432632eb53fae67]::emitter::Emitter>::emit_diagnostic
    16:        0x11107ecf4 - <rustc_errors[d432632eb53fae67]::HandlerInner>::emit_diagnostic::{closure#2}
    17:        0x11107e740 - <rustc_errors[d432632eb53fae67]::HandlerInner>::emit_diagnostic
    18:        0x1110440f8 - <! as rustc_errors[d432632eb53fae67]::diagnostic_builder::EmissionGuarantee>::diagnostic_builder_emit_producing_guarantee
    19:        0x110fbccdc - <rustc_session[2d1585dd81446882]::parse::ParseSess>::emit_fatal::<rustc_abi[e0605b52c077788c]::TargetDataLayoutErrors>
    20:        0x110fe0774 - rustc_session[2d1585dd81446882]::config::build_configuration
    21:        0x10d0f8f38 - rustc_interface[1314f46c1b9b4f85]::util::create_session
    22:        0x10d03dd3c - std[1d28f34ec6eb458]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[1314f46c1b9b4f85]::util::run_in_thread_pool_with_globals<rustc_interface[1314f46c1b9b4f85]::interface::run_compiler<core[170d39595eaee0a9]::result::Result<(), rustc_span[8569a0ccec4b189b]::ErrorGuaranteed>, rustc_driver_impl[e7720fb4bb534f5a]::run_compiler::{closure#1}>::{closure#0}, core[170d39595eaee0a9]::result::Result<(), rustc_span[8569a0ccec4b189b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[170d39595eaee0a9]::result::Result<(), rustc_span[8569a0ccec4b189b]::ErrorGuaranteed>>
    23:        0x10d02227c - <<std[1d28f34ec6eb458]::thread::Builder>::spawn_unchecked_<rustc_interface[1314f46c1b9b4f85]::util::run_in_thread_pool_with_globals<rustc_interface[1314f46c1b9b4f85]::interface::run_compiler<core[170d39595eaee0a9]::result::Result<(), rustc_span[8569a0ccec4b189b]::ErrorGuaranteed>, rustc_driver_impl[e7720fb4bb534f5a]::run_compiler::{closure#1}>::{closure#0}, core[170d39595eaee0a9]::result::Result<(), rustc_span[8569a0ccec4b189b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[170d39595eaee0a9]::result::Result<(), rustc_span[8569a0ccec4b189b]::ErrorGuaranteed>>::{closure#1} as core[170d39595eaee0a9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
    24:        0x104b03ae8 - std::sys::unix::thread::Thread::new::thread_start::h24b2c919657fff14
    25:        0x1a74fffa8 - __pthread_joiner_wake

  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.72.0-nightly (46514218f 2023-06-20) running on aarch64-apple-darwin

  note: compiler flags: --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro

  query stack during panic:
  end of query stack

Metadata

Metadata

Labels

A-target-specsArea: Compile-target specificationsA-translationArea: Translation infrastructure, and migrating existing diagnostics to SessionDiagnosticC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-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