16k-aligned statics crash rustc on Windows
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
#[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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source files or tests are named. Start by reproducing the example with cargo build --target x86_64-pc-windows-gnu, then trace the Rust compiler's LLVM Windows handling for highly aligned statics and thread locals. Done means the reproducer no longer crashes or emits STATUS_ILLEGAL_INSTRUCTION, with coverage for the affected alignment case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100