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

16k-aligned statics crash rustc on Windows #135752

Open
purplesyringa opened this issue Jan 20, 2025 · 4 comments
Open

16k-aligned statics crash rustc on Windows #135752

purplesyringa opened this issue Jan 20, 2025 · 4 comments
Labels
A-align Area: alignment control (`repr(align(N))` and so on) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-repr Area: the `#[repr(stuff)]` attribute C-bug Category: This is a bug. E-needs-investigation Call for partcipation: This issues needs some investigation to determine current status I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-windows Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@purplesyringa
Copy link
Contributor

#[repr(align(16384))]
struct HighAlignment;

static EXAMPLE: HighAlignment = const { HighAlignment };

fn main() {}
$ cargo build --target x86_64-pc-windows-gnu
...
error: could not compile `cringe` (bin "cringe"); 2 warnings emitted

Caused by:
  process didn't exit successfully: `/home/purplesyringa/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name cringe --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=211 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=2b980327f571f145 -C extra-filename=-97496ab9b6118996 --out-dir /home/purplesyringa/cringe/target/x86_64-pc-windows-gnu/debug/deps --target x86_64-pc-windows-gnu -C incremental=/home/purplesyringa/cringe/target/x86_64-pc-windows-gnu/debug/incremental -L dependency=/home/purplesyringa/cringe/target/x86_64-pc-windows-gnu/debug/deps -L dependency=/home/purplesyringa/cringe/target/debug/deps` (signal: 4, SIGILL: illegal instruction)

Also reproduces on other ABIs, also gives STATUS_ILLEGAL_INSTRUCTION when building on Windows. Also applies to thread locals. Something something IMAGE_SCN_ALIGN_ stops at 8k and LLVM fails an assertion?

Meta

rustc --version --verbose:

rustc 1.86.0-nightly (419b3e2d3 2025-01-15)
binary: rustc
commit-hash: 419b3e2d3e350822550eee0e82eeded4d324d584
commit-date: 2025-01-15
host: x86_64-unknown-linux-gnu
release: 1.86.0-nightly
LLVM version: 19.1.6

@rustbot label +I-crash +T-compiler +A-LLVM +E-needs-investigation +O-windows

@purplesyringa purplesyringa added the C-bug Category: This is a bug. label Jan 20, 2025
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. E-needs-investigation Call for partcipation: This issues needs some investigation to determine current status I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-windows Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 20, 2025
@purplesyringa purplesyringa changed the title 16k-aligned statics crash rustc 16k-aligned statics crash rustc on Windows Jan 20, 2025
@theemathas
Copy link
Contributor

Duplicate of #70144?

@jieyouxu jieyouxu added O-windows-gnu Toolchain: GNU, Operating system: Windows and removed O-windows Operating system: Windows labels Jan 20, 2025
@purplesyringa
Copy link
Contributor Author

purplesyringa commented Jan 20, 2025

Indeed seems so, though this bug report applies to non-MSVC linkers too. @jieyouxu I'd like to merge this bug into that one, thoughts?

@jieyouxu jieyouxu added O-windows Operating system: Windows and removed O-windows-gnu Toolchain: GNU, Operating system: Windows labels Jan 20, 2025
@jieyouxu

This comment has been minimized.

@jieyouxu jieyouxu removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. E-needs-investigation Call for partcipation: This issues needs some investigation to determine current status labels Jan 20, 2025
@jieyouxu
Copy link
Member

Reopening because the other issue is not quite the same.

@jieyouxu jieyouxu reopened this Jan 21, 2025
@jieyouxu jieyouxu added A-repr Area: the `#[repr(stuff)]` attribute A-align Area: alignment control (`repr(align(N))` and so on) E-needs-investigation Call for partcipation: This issues needs some investigation to determine current status labels Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-align Area: alignment control (`repr(align(N))` and so on) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-repr Area: the `#[repr(stuff)]` attribute C-bug Category: This is a bug. E-needs-investigation Call for partcipation: This issues needs some investigation to determine current status I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-windows Operating system: Windows 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