Skip to content

ICE when compiling SOLID #138047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
thaliaarchi opened this issue Mar 5, 2025 · 5 comments
Open

ICE when compiling SOLID #138047

thaliaarchi opened this issue Mar 5, 2025 · 5 comments
Labels
A-targets Area: Concerning the implications of different compiler targets C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-solid Operating System: SOLID T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@thaliaarchi
Copy link
Contributor

I get an ICE when doing x check library for the SOLID target on ac951d3 (currently master).

$ x check library --target=aarch64-kmc-solid_asp3
thread 'rustc' panicked at compiler/rustc_codegen_ssa/src/back/link.rs:91:13:
compiler/rustc_codegen_ssa/src/back/link.rs:91:13: invalid output type `Executable` for target `aarch64-kmc-solid_asp3`
stack backtrace:
   0:        0x10e9487d7 - std::backtrace::Backtrace::create::h025c1c0d8eba194b
   1:        0x10e948725 - std::backtrace::Backtrace::force_capture::ha3d23bff7bf2e84c
   2:        0x10c5cbfa7 - std[cf67b0bb2d97df8a]::panicking::update_hook::<alloc[19455c20c4fe185c]::boxed::Box<rustc_driver_impl[35a639a194169cb6]::install_ice_hook::{closure#1}>>::{closure#0}
   3:        0x10e96469a - std::panicking::rust_panic_with_hook::h18dee46b17efee88
   4:        0x10d2fbdbc - std[cf67b0bb2d97df8a]::panicking::begin_panic::<alloc[19455c20c4fe185c]::string::String>::{closure#0}
   5:        0x10d2e5289 - std[cf67b0bb2d97df8a]::sys::backtrace::__rust_end_short_backtrace::<std[cf67b0bb2d97df8a]::panicking::begin_panic<alloc[19455c20c4fe185c]::string::String>::{closure#0}, !>
   6:        0x111b9f817 - std[cf67b0bb2d97df8a]::panicking::begin_panic::<alloc[19455c20c4fe185c]::string::String>
   7:        0x10d42df21 - rustc_middle[fcc99ec23350a912]::util::bug::opt_span_bug_fmt::<rustc_span[6b81f82d1ffd9df9]::span_encoding::Span>::{closure#0}
   8:        0x10d3e51da - rustc_middle[fcc99ec23350a912]::ty::context::tls::with_opt::<rustc_middle[fcc99ec23350a912]::util::bug::opt_span_bug_fmt<rustc_span[6b81f82d1ffd9df9]::span_encoding::Span>::{closure#0}, !>::{closure#0}
   9:        0x10d3e4d15 - rustc_middle[fcc99ec23350a912]::ty::context::tls::with_context_opt::<rustc_middle[fcc99ec23350a912]::ty::context::tls::with_opt<rustc_middle[fcc99ec23350a912]::util::bug::opt_span_bug_fmt<rustc_span[6b81f82d1ffd9df9]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  10:        0x111ba384b - rustc_middle[fcc99ec23350a912]::util::bug::bug_fmt
  11:        0x10c36c8eb - rustc_codegen_ssa[54d9c015018e63e2]::back::link::link_binary
  12:        0x10cfe4e93 - <rustc_interface[5d0ab5c82cbef34c]::queries::Linker>::link
  13:        0x10c5c9e1a - rustc_interface[5d0ab5c82cbef34c]::interface::run_compiler::<(), rustc_driver_impl[35a639a194169cb6]::run_compiler::{closure#0}>::{closure#1}
  14:        0x10c5b6f3d - std[cf67b0bb2d97df8a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[5d0ab5c82cbef34c]::util::run_in_thread_with_globals<rustc_interface[5d0ab5c82cbef34c]::util::run_in_thread_pool_with_globals<rustc_interface[5d0ab5c82cbef34c]::interface::run_compiler<(), rustc_driver_impl[35a639a194169cb6]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  15:        0x10c5d0b19 - <<std[cf67b0bb2d97df8a]::thread::Builder>::spawn_unchecked_<rustc_interface[5d0ab5c82cbef34c]::util::run_in_thread_with_globals<rustc_interface[5d0ab5c82cbef34c]::util::run_in_thread_pool_with_globals<rustc_interface[5d0ab5c82cbef34c]::interface::run_compiler<(), rustc_driver_impl[35a639a194169cb6]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[e104967a20141428]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  16:        0x10e96fc1b - std::sys::pal::unix::thread::Thread::new::thread_start::h8b6d31becd316321
  17:     0x7ff80905a253 - __pthread_start


rustc version: 1.86.0-beta.1 (f0cb41030 2025-02-17)
platform: x86_64-apple-darwin

cc @Noratrieb

@thaliaarchi thaliaarchi added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 5, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 5, 2025
@bjorn3
Copy link
Member

bjorn3 commented Mar 5, 2025

SOLID doesn't allow executables:

Should probably report an error rather than ICE though. At
if invalid_output_for_target(session, *crate_type) {
session.dcx().emit_warn(errors::UnsupportedCrateTypeForTarget {
crate_type: *crate_type,
target_triple: &session.opts.target_triple,
});
false
} else {
true
}
we normally error for unsupported crate types, but when compiling as test crate, this code is bypassed by the return vec![CrateType::Executable]; earlier in this function.

@jieyouxu jieyouxu added A-targets Area: Concerning the implications of different compiler targets O-solid Operating System: SOLID and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 5, 2025
@thaliaarchi
Copy link
Contributor Author

thaliaarchi commented Mar 5, 2025

The following patch, which I think is what you suggest, still produces the same ICE:

diff --git a/compiler/rustc_session/src/output.rs b/compiler/rustc_session/src/output.rs
index b37a80274c0..27d257bf322 100644
--- a/compiler/rustc_session/src/output.rs
+++ b/compiler/rustc_session/src/output.rs
@@ -177,6 +177,13 @@ pub fn collect_crate_types(session: &Session, attrs: &[ast::Attribute]) -> Vec<C
     // If we're generating a test executable, then ignore all other output
     // styles at all other locations
     if session.opts.test {
+        if !session.target.executables {
+            session.dcx().emit_warn(errors::UnsupportedCrateTypeForTarget {
+                crate_type: CrateType::Executable,
+                target_triple: &session.opts.target_triple,
+            });
+            return Vec::new();
+        }
         return vec![CrateType::Executable];
     }

@bjorn3
Copy link
Member

bjorn3 commented Mar 6, 2025

That is because ./x.py check library uses the bootstrap compiler which is downloaded in precompiled form. ./x.py check library --stage 1 may work, though I'm not sure if ./x.py check accepts --stage at all.

@thaliaarchi
Copy link
Contributor Author

Strange… x check library --target=aarch64-kmc-solid_asp3 --stage=1 works with and without the patch.

@thaliaarchi
Copy link
Contributor Author

I've opened #138906 to fix this.

Zalathar added a commit to Zalathar/rust that referenced this issue Apr 15, 2025
…r=bjorn3

Reject test executables when not supported by target

Currently, compiling tests for SOLID produces an ICE, because SOLID does not support executables.

See rust-lang#138047
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 15, 2025
…bjorn3

Reject test executables when not supported by target

Currently, compiling tests for SOLID produces an ICE, because SOLID does not support executables.

See rust-lang#138047
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this issue Apr 17, 2025
Reject test executables when not supported by target

Currently, compiling tests for SOLID produces an ICE, because SOLID does not support executables.

See rust-lang/rust#138047
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Apr 17, 2025
Reject test executables when not supported by target

Currently, compiling tests for SOLID produces an ICE, because SOLID does not support executables.

See rust-lang/rust#138047
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-targets Area: Concerning the implications of different compiler targets C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-solid Operating System: SOLID T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants