Repository: rust
Issue: ERROR : rustc interrupted by SIGSEGV
Labels: I-crash,A-LLVM,C-bug,S-needs-repro

**Title:** Error encountered while installing Rust 1.76.0 on Ubuntu 22.04

**Description:**

I encountered an issue while trying to install Rust version 1.76.0 on my system. Below are the details of the error and my environment: 
**Error Message:**
```
[](   Compiling libz-sys v1.1.16
   Compiling serde v1.0.202
error: rustc interrupted by SIGSEGV, printing backtrace

/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/librustc_driver-ef0b2e016afc8182.so(+0x2c31aa6)[0x7f50a2a31aa6]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f509fc19520]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(+0x60b1ffe)[0x7f509e2b1ffe]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(_ZN4llvm18BlockFrequencyInfo9calculateERKNS_8FunctionERKNS_21BranchProbabilityInfoERKNS_8LoopInfoE+0x161)[0x7f509e2bf46f]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(+0x5e135d2)[0x7f509e0135d2]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(_ZN4llvm15AnalysisManagerINS_8FunctionEJEE13getResultImplEPNS_11AnalysisKeyERS1_+0x356)[0x7f509e013b16]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(+0x62d62bc)[0x7f509e4d62bc]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(+0x62df430)[0x7f509e4df430]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(_ZN4llvm12shouldInlineERNS_8CallBaseENS_12function_refIFNS_10InlineCostES1_EEERNS_25OptimizationRemarkEmitterEb+0x30d)[0x7f509e1c76cd]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(_ZN4llvm20DefaultInlineAdvisor13getAdviceImplERNS_8CallBaseE+0x1c8)[0x7f509e1c71da]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(_ZN4llvm11InlinerPass3runERNS_13LazyCallGraph3SCCERNS_15AnalysisManagerIS2_JRS1_EEES5_RNS_17CGSCCUpdateResultE+0x878)[0x7f509e29d838]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(+0x609cfb3)[0x7f509e29cfb3]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(_ZN4llvm11PassManagerINS_13LazyCallGraph3SCCENS_15AnalysisManagerIS2_JRS1_EEEJS4_RNS_17CGSCCUpdateResultEEE3runERS2_RS5_S4_S7_+0x995)[0x7f509e3b7f55]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(+0x61b75a9)[0x7f509e3b75a9]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(_ZN4llvm21DevirtSCCRepeatedPass3runERNS_13LazyCallGraph3SCCERNS_15AnalysisManagerIS2_JRS1_EEES5_RNS_17CGSCCUpdateResultE+0x15e)[0x7f509e3b67f4]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(_ZN4llvm33ModuleToPostOrderCGSCCPassAdaptor3runERNS_6ModuleERNS_15AnalysisManagerIS1_JEEE+0x673)[0x7f509e29a433]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(+0x6099da9)[0x7f509e299da9]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(_ZN4llvm11PassManagerINS_6ModuleENS_15AnalysisManagerIS1_JEEEJEE3runERS1_RS3_+0xb9)[0x7f509e3ba1f9]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(_ZN4llvm24ModuleInlinerWrapperPass3runERNS_6ModuleERNS_15AnalysisManagerIS1_JEEE+0x1ab)[0x7f509e7972bd]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(+0x659710d)[0x7f509e79710d]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libLLVM-17-rust-1.76.0-stable.so(_ZN4llvm11PassManagerINS_6ModuleENS_15AnalysisManagerIS1_JEEEJEE3runERS1_RS3_+0xb9)[0x7f509e3ba1f9]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/librustc_driver-ef0b2e016afc8182.so(LLVMRustOptimize+0x887)[0x7f50a48e6107]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/librustc_driver-ef0b2e016afc8182.so(+0x4937622)[0x7f50a4737622]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/librustc_driver-ef0b2e016afc8182.so(_RNvXs1_Cs59QrpCZBv10_18rustc_codegen_llvmNtB5_18LlvmCodegenBackendNtNtNtCschqvOleydkH_17rustc_codegen_ssa6traits5write19WriteBackendMethods8optimize+0xe6)[0x7f50a48156be]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/librustc_driver-ef0b2e016afc8182.so(+0x4aabb0f)[0x7f50a48abb0f]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/librustc_driver-ef0b2e016afc8182.so(+0x4aab6c2)[0x7f50a48ab6c2]
/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/lib/libstd-66d8041607d2929b.so(rust_metadata_std_79729d9c385e1623+0xbe8e5)[0x7f50a5ad58e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x94ac3)[0x7f509fc6bac3]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x44)[0x7f509fcfca04]

note: we would appreciate a report at https://github.com/rust-lang/rust
note: backtrace dumped due to SIGSEGV! resuming signal
error: could not compile `regex-syntax` (lib)

Caused by:
  process didn't exit successfully: `/opt/scorer/toolchains/1.76.0-x86_64-unknown-linux-gnu/bin/rustc --crate-name regex_syntax --edition=2021 /opt/scorer/registry/src/index.crates.io-6f17d22bba15001f/regex-syntax-0.8.3/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=204 --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="std"' --cfg 'feature="unicode"' --cfg 'feature="unicode-age"' --cfg 'feature="unicode-bool"' --cfg 'feature="unicode-case"' --cfg 'feature="unicode-gencat"' --cfg 'feature="unicode-perl"' --cfg 'feature="unicode-script"' --cfg 'feature="unicode-segment"' -C metadata=72c1ed96a96c17f6 -C extra-filename=-72c1ed96a96c17f6 --out-dir /tmp/cargo-installQbu2oE/release/deps -L dependency=/tmp/cargo-installQbu2oE/release/deps --cap-lints allow` (signal: 11, SIGSEGV: invalid memory reference)
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-c v0.9.32+cargo-0.79.0`, intermediate artifacts can be found at `/tmp/cargo-installQbu2oE`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.


@@@@ PKG: { elapsed: 121.425, user: 82.573, system: 16.251, percent: 81.38 } @@@@
)
```
**Steps to Reproduce:**

   - Set up environment variables for installation path:
```
export CARGO_HOME={$INSTALLATION_PATH}
export RUSTUP_HOME={$INSTALLATION_PATH}
```
 - Download and run the Rust installer:
`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path`
- Install cargo-c:
`cargo install cargo-c`


**Expected Behavior:**

Rust should install successfully without any errors, and cargo-c should be installed without issues.

**Actual Behavior:**

The installation process fails with the error mentioned above.

**Environment:**

    Operating System: Ubuntu 22.04
    Linux Kernel: 6.5.0-0.deb12.4
    Python Version: Python 3.11.9
    Processor: Intel Processor N100
    Rust Version Attempted: 1.76.0
    Installation Method: rustup
    Installation Path: {$INSTALLATION_PATH}