Skip to content

SIGSEGV with -Cremark=all on aarch64-apple-darwin #149996

@rosborn

Description

@rosborn

When compiling with -Cremark=all, rustc crashes with SIGSEGV in LLVM's optimization remarks infrastructure.

Code

# Cargo.toml
[package]
name = "rustc-crash"
version = "0.1.0"
edition = "2024"

[dependencies]
serde_derive = "1.0.228"
// src/main.rs
fn main() {
    println!("Hello, world!");
}

Build command:

RUSTFLAGS="-Cremark=all" cargo build --release

Meta

rustc --version --verbose (stable):

rustc 1.91.1 (ed61e7d7e 2025-11-07)
binary: rustc
commit-hash: ed61e7d7e242494fb7057f2657300d9e77bb4fcb
commit-date: 2025-11-07
host: aarch64-apple-darwin
release: 1.91.1
LLVM version: 21.1.2

Also reproduces on nightly:

rustc 1.94.0-nightly (430d8297c 2025-12-13)
binary: rustc
commit-hash: 430d8297c712ca7e8a4866d7ddccf1b71ba5d4d3
commit-date: 2025-12-13
host: aarch64-apple-darwin
release: 1.94.0-nightly
LLVM version: 21.1.5

Error output

error: could not compile `serde_derive` (lib); 1 warning emitted

Caused by:
  process didn't exit successfully: `rustc --crate-name serde_derive --edition=2021 ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/serde_derive-1.0.228/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("default", "deserialize_in_place"))' -C metadata=2aaebbc6abf19169 -C extra-filename=-2e610fdd5c6d87b9 --out-dir /private/tmp/rustc-crash-final/target/release/deps -C strip=debuginfo -L dependency=/private/tmp/rustc-crash-final/target/release/deps --extern proc_macro2=/private/tmp/rustc-crash-final/target/release/deps/libproc_macro2-f8c95172c18a4071.rlib --extern quote=/private/tmp/rustc-crash-final/target/release/deps/libquote-7d7d8a774396dc6e.rlib --extern syn=/private/tmp/rustc-crash-final/target/release/deps/libsyn-678f1af0fcf23e31.rlib --extern proc_macro --cap-lints allow -Cremark=all` (signal: 11, SIGSEGV: invalid memory reference)

note: we would appreciate a report at https://github.com/rust-lang/rust
help: you can increase rustc's stack size by setting RUST_MIN_STACK=16777216
Backtrace

There was no Rust backtrace only the native backtrace from macOS crash report:

Crashed Thread:        7  opt cgu.11

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0xa90667fad102c417 -> 0x000067fad102c417 (possible pointer authentication failure)

Thread 7 Crashed:: opt cgu.11
0   librustc_driver-98675b6d366d1d69.dylib  0x1117f71d8 llvm::MachineOptimizationRemarkAnalysis::isEnabled() const + 64
1   librustc_driver-98675b6d366d1d69.dylib  0x113823f80 LLVMRustContextConfigureDiagnosticHandler::RustDiagnosticHandler::handleDiagnostics(llvm::DiagnosticInfo const&) + 64
2   librustc_driver-98675b6d366d1d69.dylib  0x1135ff2f4 llvm::LLVMContext::diagnose(llvm::DiagnosticInfo const&) + 200
3   librustc_driver-98675b6d366d1d69.dylib  0x11294d808 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 1472
4   librustc_driver-98675b6d366d1d69.dylib  0x113609ed8 llvm::FPPassManager::runOnFunction(llvm::Function&) + 668
5   librustc_driver-98675b6d366d1d69.dylib  0x1136105a4 llvm::FPPassManager::runOnModule(llvm::Module&) + 60
6   librustc_driver-98675b6d366d1d69.dylib  0x11360a90c llvm::legacy::PassManagerImpl::run(llvm::Module&) + 2008
7   librustc_driver-98675b6d366d1d69.dylib  0x1138186ac LLVMRustWriteOutputFile + 528
8   librustc_driver-98675b6d366d1d69.dylib  0x10e7b5bdc _RNvNtNtCs3o6FctvUe2b_18rustc_codegen_llvm4back5write17write_output_file + 268
9   librustc_driver-98675b6d366d1d69.dylib  0x10e7b8d8c _RNvNtNtCs3o6FctvUe2b_18rustc_codegen_llvm4back5write7codegen + 3532
10  librustc_driver-98675b6d366d1d69.dylib  0x10e7392f8 _RINvNtNtCskrnul4B7SZq_17rustc_codegen_ssa4back5write26execute_optimize_work_itemNtCs3o6FctvUe2b_18rustc_codegen_llvm18LlvmCodegenBackendEB1i_ + 676
11  librustc_driver-98675b6d366d1d69.dylib  0x10e739848 ... + 284
12  librustc_driver-98675b6d366d1d69.dylib  0x10e76d660 ... + 496
13  librustc_driver-98675b6d366d1d69.dylib  0x110ab5a80 std::sys::thread::unix::Thread::new::thread_start + 52
14  libsystem_pthread.dylib                 0x18bad7c0c _pthread_start + 136
15  libsystem_pthread.dylib                 0x18bad2b80 thread_start + 8

Thread 7 crashed with ARM Thread State (64-bit):
    x8: 0xa90667fad102c3ff (invalid pointer - PAC failure)
    pc: 0x00000001117f71d8 cpsr: 0x60000000
   far: 0xa90667fad102c417  esr: 0x92000004 (Data Abort) byte read Translation fault

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.O-AArch64Armv8-A or later processors in AArch64 modeT-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