Skip to content

SIGSEGV when using incremental, '--test' and realtime sanitizer #149250

@inkreasing

Description

@inkreasing

I tried this code:

#![feature(sanitize)]

fn main() {
    let result = add(2, 2);
    assert_eq!(result, 4)
}

#[sanitize(realtime = "nonblocking")]
pub fn add(left: u64, right: u64) -> u64 {
    left + right
}

#[cfg(test)]
mod test {
    use super::*;

    #[test]
    fn test() {
        let result = add(2, 2);
        assert_eq!(result, 4);
    }
}

with rustc src/main.rs --test -C incremental={some folder} -Zsanitizer=realtime
If either test or incremental or realtime sanitizer command line flag is removed it doesn't crash anymore. From the backtrace it looks like a llvm bug, but i tried emit=llvm-ir and then calling llc on that, but that seemed to work fine. It could of couse still be a llvm bug.

I expected to see this happen: compiles

Instead, this happened: SIGSEGV

Meta

rustc --version --verbose:

rustc 1.93.0-nightly (94b49fd99 2025-11-22)
binary: rustc
commit-hash: 94b49fd998d6723e0a9240a7cff5f9df37b84dd8
commit-date: 2025-11-22
host: aarch64-apple-darwin
release: 1.93.0-nightly
LLVM version: 21.1.5
Backtrace

error: rustc interrupted by SIGSEGV, printing backtrace

0   librustc_driver-16b1f550720647e6.dy 0x0000000110dbab8c _RNvNtCs99FapbrAgm6_17rustc_driver_impl14signal_handler17print_stack_trace + 140
1   libsystem_platform.dylib            0x000000019c4416a4 _sigtramp + 56
2   librustc_driver-16b1f550720647e6.dy 0x00000001141cda58 _ZL27insertCallBeforeInstructionRN4llvm8FunctionERNS_11InstructionEPKcNS_8ArrayRefIPNS_5ValueEEE + 316
3   librustc_driver-16b1f550720647e6.dy 0x00000001141cd5e8 _ZN4llvm21RealtimeSanitizerPass3runERNS_6ModuleERNS_15AnalysisManagerIS1_JEEE + 388
4   librustc_driver-16b1f550720647e6.dy 0x00000001158d97a0 _ZN4llvm11PassManagerINS_6ModuleENS_15AnalysisManagerIS1_JEEEJEE3runERS1_RS3_ + 280
5   librustc_driver-16b1f550720647e6.dy 0x0000000115ab6c3c LLVMRustOptimize + 10804
6   librustc_driver-16b1f550720647e6.dy 0x0000000110a95400 _RNvNtNtCscmi45mdQtkA_18rustc_codegen_llvm4back5write13llvm_optimize + 3268
7   librustc_driver-16b1f550720647e6.dy 0x0000000110ad5028 _RNvXs1_Cscmi45mdQtkA_18rustc_codegen_llvmNtB5_18LlvmCodegenBackendNtNtNtCsezIrwaAAZdA_17rustc_codegen_ssa6traits5write19WriteBackendMethods8optimize + 460
8   librustc_driver-16b1f550720647e6.dy 0x0000000110a141c0 _RINvNtNtCsezIrwaAAZdA_17rustc_codegen_ssa4back5write26execute_optimize_work_itemNtCscmi45mdQtkA_18rustc_codegen_llvm18LlvmCodegenBackendEB1i_ + 152
9   librustc_driver-16b1f550720647e6.dy 0x0000000110a1508c _RINvNtNtCskpKSKVtn3H6_3std3sys9backtrace28___rust_begin_short_backtraceNCINvXs0_Cscmi45mdQtkA_18rustc_codegen_llvmNtB1g_18LlvmCodegenBackendNtNtNtCsezIrwaAAZdA_17rustc_codegen_ssa6traits7backend19ExtraBackendMethods18spawn_named_threadNCINvNtNtB2k_4back5write10spawn_workB1O_E0uE0uEB1g_ + 176
10  librustc_driver-16b1f550720647e6.dy 0x0000000110a49ad0 _RNSNvYNCINvMNtCskpKSKVtn3H6_3std6threadNtBa_7Builder16spawn_unchecked_NCINvXs0_Cscmi45mdQtkA_18rustc_codegen_llvmNtB1f_18LlvmCodegenBackendNtNtNtCsezIrwaAAZdA_17rustc_codegen_ssa6traits7backend19ExtraBackendMethods18spawn_named_threadNCINvNtNtB2j_4back5write10spawn_workB1N_E0uE0uEs_0INtNtNtCshcx3WXiymsJ_4core3ops8function6FnOnceuE9call_once6vtableB1f_ + 456
11  librustc_driver-16b1f550720647e6.dy 0x0000000112d56424 _ZN3std3sys6thread4unix6Thread3new12thread_start17h59b69fa380c42a3cE + 52
12  libsystem_pthread.dylib             0x000000019c407bc8 _pthread_start + 136
13  libsystem_pthread.dylib             0x000000019c402b80 thread_start + 8

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
zsh: segmentation fault  /Users/_/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/rustc

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.C-external-bugCategory: issue that is caused by bugs in software beyond our controlI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-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