Skip to content
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

SIGILL trying to build bstr in a no_std environment #137138

Open
ObserverUnit opened this issue Feb 16, 2025 · 3 comments
Open

SIGILL trying to build bstr in a no_std environment #137138

ObserverUnit opened this issue Feb 16, 2025 · 3 comments
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ObserverUnit
Copy link

Code

there is a bare-bone example in this repo
clone it then do
cargo build --target x86_64-unknown-none

Meta

rustc --version --verbose:

c 1.81.0 (eeb90cda1 2024-09-04)
binary: rustc
commit-hash: eeb90cda1969383f56a2637cbd3037bdf598841c
commit-date: 2024-09-04
host: x86_64-unknown-linux-gnu
release: 1.81.0
LLVM version: 18.1.7

same problem for latest nightly as of writing this (nightly-2025-02-16) and beta too

Error output

error: could not compile `bstr` (lib)

Caused by:
  process didn't exit successfully: `/home/aler/.rustup/toolchains/nightly-2025-02-16-x86_64-unknown-linux-gnu/bin/rustc --crate-name bstr --edition=2021 /home/aler/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bstr-1.11.3/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=182 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("alloc", "default", "serde", "std", "unicode"))' -C metadata=88315fca68f793d3 -C extra-filename=-838f38bd3ea009ac --out-dir /home/aler/Documents/head/target/x86_64-unknown-none/debug/deps --target x86_64-unknown-none -L dependency=/home/aler/Documents/head/target/x86_64-unknown-none/debug/deps -L dependency=/home/aler/Documents/head/target/debug/deps --extern memchr=/home/aler/Documents/head/target/x86_64-unknown-none/debug/deps/libmemchr-e902a720dd10a02a.rmeta --cap-lints allow -C panic=abort -C relocation-model=static` (signal: 4, SIGILL: illegal instruction)

i have also tried reporting this at bstr's repo

Backtrace

@ObserverUnit ObserverUnit 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 Feb 16, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 16, 2025
@cyrgani
Copy link
Contributor

cyrgani commented Feb 16, 2025

reduction:

rustc --target x86_64-unknown-none uwu.rs --crate-type=lib

#![no_std]

pub fn first_non_ascii_byte_sse2(slice: &[u8]) {
    use core::arch::x86_64::*;

    unsafe {
        let chunk = _mm_loadu_si128(slice.as_ptr() as *const __m128i);
        _mm_movemask_epi8(chunk);
    }
}

@rustbot label -I-ICE I-crash

@rustbot rustbot added I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Feb 16, 2025
@Noratrieb Noratrieb added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Feb 16, 2025
@Noratrieb
Copy link
Member

Noratrieb commented Feb 16, 2025

With LLVM assertions I get
rustc: /checkout/src/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:7931: SDValue getMemcpyLoadsAndStores(SelectionDAG &, const SDLoc &, SDValue, SDValue, SDValue, uint64_t, Align, bool, bool, MachinePointerInfo, MachinePointerInfo, const AAMDNodes &, AAResults *): Assertion 'NVT.bitsGE(VT)' failed.

@Noratrieb Noratrieb removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 16, 2025
@Noratrieb
Copy link
Member

This might have something to do with x86_64-unknown-none being a softfloat target without SSE enabled, and you using SSE (though -Ctarget-feature=+sse2,+sse does not seem to help).

Zalathar added a commit to Zalathar/rust that referenced this issue Feb 18, 2025
…kingjubilee

Install more signal stack trace handlers

This PR install the signal stack handler to more signals (`SIGILL`, ~~`SIGTRAP`~~, ~~`SIGABRT`~~, ~~`SIGFPE`~~, `SIGBUS`, ~~`SIGQUIT`~~).

Noticed in rust-lang#137138 that we didn't print anything for `SIGILL`, so I though we could just handle more signals.

r? `@workingjubilee` since you last touched it
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 18, 2025
…kingjubilee

Install more signal stack trace handlers

This PR install the signal stack handler to more signals (`SIGILL`, ~~`SIGTRAP`~~, ~~`SIGABRT`~~, ~~`SIGFPE`~~, `SIGBUS`, ~~`SIGQUIT`~~).

Noticed in rust-lang#137138 that we didn't print anything for `SIGILL`, so I though we could just handle more signals.

r? ``@workingjubilee`` since you last touched it
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Feb 18, 2025
…kingjubilee

Install more signal stack trace handlers

This PR install the signal stack handler to more signals (`SIGILL`, ~~`SIGTRAP`~~, ~~`SIGABRT`~~, ~~`SIGFPE`~~, `SIGBUS`, ~~`SIGQUIT`~~).

Noticed in rust-lang#137138 that we didn't print anything for `SIGILL`, so I though we could just handle more signals.

r? ```@workingjubilee``` since you last touched it
Urgau added a commit to Urgau/rust that referenced this issue Feb 18, 2025
…kingjubilee

Install more signal stack trace handlers

This PR install the signal stack handler to more signals (`SIGILL`, ~~`SIGTRAP`~~, ~~`SIGABRT`~~, ~~`SIGFPE`~~, `SIGBUS`, ~~`SIGQUIT`~~).

Noticed in rust-lang#137138 that we didn't print anything for `SIGILL`, so I though we could just handle more signals.

r? ````@workingjubilee```` since you last touched it
Urgau added a commit to Urgau/rust that referenced this issue Feb 18, 2025
…kingjubilee

Install more signal stack trace handlers

This PR install the signal stack handler to more signals (`SIGILL`, ~~`SIGTRAP`~~, ~~`SIGABRT`~~, ~~`SIGFPE`~~, `SIGBUS`, ~~`SIGQUIT`~~).

Noticed in rust-lang#137138 that we didn't print anything for `SIGILL`, so I though we could just handle more signals.

r? `````@workingjubilee````` since you last touched it
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 18, 2025
…kingjubilee

Install more signal stack trace handlers

This PR install the signal stack handler to more signals (`SIGILL`, ~~`SIGTRAP`~~, ~~`SIGABRT`~~, ~~`SIGFPE`~~, `SIGBUS`, ~~`SIGQUIT`~~).

Noticed in rust-lang#137138 that we didn't print anything for `SIGILL`, so I though we could just handle more signals.

r? ``````@workingjubilee`````` since you last touched it
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 18, 2025
Rollup merge of rust-lang#137151 - Urgau:register-more-signals, r=workingjubilee

Install more signal stack trace handlers

This PR install the signal stack handler to more signals (`SIGILL`, ~~`SIGTRAP`~~, ~~`SIGABRT`~~, ~~`SIGFPE`~~, `SIGBUS`, ~~`SIGQUIT`~~).

Noticed in rust-lang#137138 that we didn't print anything for `SIGILL`, so I though we could just handle more signals.

r? `````@workingjubilee````` since you last touched it
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Feb 19, 2025
Install more signal stack trace handlers

This PR install the signal stack handler to more signals (`SIGILL`, ~~`SIGTRAP`~~, ~~`SIGABRT`~~, ~~`SIGFPE`~~, `SIGBUS`, ~~`SIGQUIT`~~).

Noticed in rust-lang/rust#137138 that we didn't print anything for `SIGILL`, so I though we could just handle more signals.

r? `````@workingjubilee````` since you last touched it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. 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