Skip to content

custom target options cause panic #120625

Closed
@thedude3253

Description

@thedude3253

After some testing I found this bug occurs if there's a space between the comma and the - or + in a target json file. I don't know if this is a problem or not, since it does give a sensible error message, but you requested a bug report so I thought I would do due diligence.

rustc-ice-2024-02-03T21_20_07-1744.txt

Code

{
	"llvm-target": "x86_64-unknown-none",
	"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
	"arch": "x86_64",
	"target-endian": "little",
	"target-pointer-width": "64",
	"target-c-int-width": "32",
	"os": "none",
	"executables": true,
	"panic-strategy": "abort",
	"disable-redzone": true,
	"features": "-mmx, -sse,+soft-float"
}

Meta

rustc --version --verbose:

rustc 1.77.0-nightly (bf3c6c5be 2024-02-01)
binary: rustc
commit-hash: bf3c6c5bed498f41ad815641319a1ad9bcecb8e8
commit-date: 2024-02-01
host: x86_64-pc-windows-msvc
release: 1.77.0-nightly
LLVM version: 17.0.6

Error output

 process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --target \\?\C:\Users\jasro\Projects\based_os\x86_64-based_os.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 code: 101)
  --- stderr
  thread 'rustc' panicked at compiler\rustc_middle\src\util\bug.rs:36:26:
  compiler\rustc_codegen_llvm\src\llvm_util.rs:617:9: target feature ` -sse` must begin with a `+` or `-`
  
stack backtrace:
  <edited out stacktrace to paste below>

  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 `C:\Users\jasro\Projects\based_os\rustc-ice-2024-02-03T21_20_07-1744.txt` to your bug report

  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
Backtrace

     0:     0x7ff8786628b2 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h270c9b3d33220721
     1:     0x7ff8786954dd - core::fmt::write::ha35f4a2cc1049a07
     2:     0x7ff878658f41 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::h420e8ab032a71eb5
     3:     0x7ff8786626da - std::sys_common::backtrace::lock::h3a26f0b160addb75
     4:     0x7ff878665a79 - std::panicking::default_hook::hb2c3cd10f200182d
     5:     0x7ff878665735 - std::panicking::default_hook::hb2c3cd10f200182d
     6:     0x7ff8740f20c3 - <tracing_subscriber[85016e1f3cdc5516]::fmt::format::Writer>::write_fmt
     7:     0x7ff878666083 - std::panicking::rust_panic_with_hook::hdb9f1391d71dcb3b
     8:     0x7ff875495a64 - <rustc_middle[7f37ca182088f1e2]::ty::instance::Instance as rustc_middle[7f37ca182088f1e2]::ty::context::Lift>::lift_to_tcx
     9:     0x7ff875494c99 - <rustc_middle[7f37ca182088f1e2]::ty::instance::Instance as rustc_middle[7f37ca182088f1e2]::ty::context::Lift>::lift_to_tcx
    10:     0x7ff87542c8b3 - <rustc_middle[7f37ca182088f1e2]::thir::ParamId as core[313faab2dab151cb]::fmt::Debug>::fmt
    11:     0x7ff87547dede - rustc_middle[7f37ca182088f1e2]::util::bug::bug_fmt
    12:     0x7ff87547d53d - <rustc_middle[7f37ca182088f1e2]::ty::assoc::AssocItems>::find_by_name_and_kinds
    13:     0x7ff87547d50d - <rustc_middle[7f37ca182088f1e2]::ty::assoc::AssocItems>::find_by_name_and_kinds
    14:     0x7ff87547de02 - rustc_middle[7f37ca182088f1e2]::util::bug::bug_fmt
    15:     0x7ff8742a1187 - rustc_codegen_llvm[32f000f5d661d08a]::llvm_::last_error
    16:     0x7ff8702295ea - <rustc_codegen_llvm[32f000f5d661d08a]::debuginfo::CodegenUnitDebugContext as core[313faab2dab151cb]::ops::drop::Drop>::drop
    17:     0x7ff8701fce5a - rustc_codegen_llvm[32f000f5d661d08a]::llvm_util::global_llvm_features
    18:     0x7ff8701f5bc1 - <rustc_codegen_llvm[32f000f5d661d08a]::llvm_::ffi::Type>::ptr_llcx
    19:     0x7ff8701ddf86 - <rustc_codegen_llvm[32f000f5d661d08a]::LlvmCodegenBackend as rustc_codegen_ssa[89759ff15f2a6af7]::traits::backend::CodegenBackend>::target_features
    20:     0x7ff87017641b - rustc_interface[64bd67b45b2822f2]::util::add_configuration
    21:     0x7ff8701543fe - <rustc_middle[7f37ca182088f1e2]::ty::SymbolName as core[313faab2dab151cb]::fmt::Debug>::fmt
    22:     0x7ff87011a84f - rustc_driver_impl[5421d9693dd0d1e9]::main
    23:     0x7ff870121e28 - rustc_driver_impl[5421d9693dd0d1e9]::args::arg_expand_all
    24:     0x7ff878677abc - std::sys::pal::windows::thread::Thread::new::h5f65b4d6eec25234
    25:     0x7ff90ff9257d - BaseThreadInitThunk
    26:     0x7ff910f0aa58 - RtlUserThreadStart

Metadata

Metadata

Assignees

Labels

C-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