rust-lang / rust-lang/rust

rustc unexpectedly overflowed its stack! this is a bug

Open
#136,282 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-LLVM C-bug E-needs-mcve I-crash
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I get this whenever compiling with the following lines in my Cargo.toml:

[profile.release]
lto = true

If I remove these lines, compilation works fine. Otherwise, I see the below. I'm happy to provide more information if helpful.

error: rustc interrupted by SIGSEGV, printing backtrace

/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/librustc_driver-3f4ebb066deec3c0.so(+0x32b0323)[0x7765dd0b0323]
/lib/x86_64-linux-gnu/libc.so.6(+0x42990)[0x7765d9a42990]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(+0x5c78e11)[0x7765d7e78e11]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm16computeKnownBitsEPKNS_5ValueERNS_9KnownBitsEjRKNS_13SimplifyQueryE+0xcb)[0x7765d7e7754b]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(+0x5c79291)[0x7765d7e79291]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm16computeKnownBitsEPKNS_5ValueERNS_9KnownBitsEjRKNS_13SimplifyQueryE+0xcb)[0x7765d7e7754b]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution23getConstantMultipleImplEPKNS_4SCEVE+0x25c)[0x7765d4a37f6c]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution11getRangeRefEPKNS_4SCEVENS0_13RangeSignHintEj+0x42a)[0x7765d85474ea]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution10getAddExprERNS_15SmallVectorImplIPKNS_4SCEVEEENS2_11NoWrapFlagsEj+0xc2d)[0x7765d8059a2d]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution10getGEPExprEPNS_11GEPOperatorERKNS_15SmallVectorImplIPKNS_4SCEVEEE+0x7da)[0x7765d803f36a]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution10createSCEVEPNS_5ValueE+0x4a2)[0x7765d803a222]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution14createSCEVIterEPNS_5ValueE+0x3bc)[0x7765d803883c]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution11getRangeRefEPKNS_4SCEVENS0_13RangeSignHintEj+0x208b)[0x7765d854914b]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution10getAddExprERNS_15SmallVectorImplIPKNS_4SCEVEEENS2_11NoWrapFlagsEj+0xc2d)[0x7765d8059a2d]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution10getGEPExprEPNS_11GEPOperatorERKNS_15SmallVectorImplIPKNS_4SCEVEEE+0x7da)[0x7765d803f36a]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution10createSCEVEPNS_5ValueE+0x4a2)[0x7765d803a222]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution14createSCEVIterEPNS_5ValueE+0x3bc)[0x7765d803883c]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution19createAddRecFromPHIEPNS_7PHINodeE+0x3d4)[0x7765d803c2d4]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution10createSCEVEPNS_5ValueE+0x4d0)[0x7765d803a250]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution14createSCEVIterEPNS_5ValueE+0x3bc)[0x7765d803883c]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution28computeExitLimitFromCondImplERNS0_14ExitLimitCacheEPKNS_4LoopEPNS_5ValueEbbb+0x26c)[0x7765d8124c6c]

### cycle encountered after 21 frames with period 24
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution25computeBackedgeTakenCountEPKNS_4LoopEb+0x7f8)[0x7765d8125ff8]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution11getRangeRefEPKNS_4SCEVENS0_13RangeSignHintEj+0x60e5)[0x7765d854d1a5]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution31isKnownViaNonRecursiveReasoningENS_7CmpInst9PredicateEPKNS_4SCEVES5_+0x114)[0x7765d837466e]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution13getMinMaxExprENS_9SCEVTypesERNS_15SmallVectorImplIPKNS_4SCEVEEE+0x383)[0x7765d804b0db]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution15applyLoopGuardsEPKNS_4SCEVEPKNS_4LoopE+0xf84)[0x7765d804d104]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution12howFarToZeroEPKNS_4SCEVEPKNS_4LoopEbb+0x46e)[0x7765d863dabe]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution24computeExitLimitFromICmpEPKNS_4LoopENS_7CmpInst9PredicateEPKNS_4SCEVES8_bb+0x3f9)[0x7765d8121dff]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution28computeExitLimitFromCondImplERNS0_14ExitLimitCacheEPKNS_4LoopEPNS_5ValueEbbb+0x39c)[0x7765d8124d9c]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution25computeBackedgeTakenCountEPKNS_4LoopEb+0x7f8)[0x7765d8125ff8]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution11getRangeRefEPKNS_4SCEVENS0_13RangeSignHintEj+0x60e5)[0x7765d854d1a5]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution31isKnownViaNonRecursiveReasoningENS_7CmpInst9PredicateEPKNS_4SCEVES5_+0x114)[0x7765d837466e]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution13getMinMaxExprENS_9SCEVTypesERNS_15SmallVectorImplIPKNS_4SCEVEEE+0x383)[0x7765d804b0db]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution15applyLoopGuardsEPKNS_4SCEVEPKNS_4LoopE+0xf84)[0x7765d804d104]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution12howFarToZeroEPKNS_4SCEVEPKNS_4LoopEbb+0x46e)[0x7765d863dabe]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution24computeExitLimitFromICmpEPKNS_4LoopENS_7CmpInst9PredicateEPKNS_4SCEVES8_bb+0x3f9)[0x7765d8121dff]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution28computeExitLimitFromCondImplERNS0_14ExitLimitCacheEPKNS_4LoopEPNS_5ValueEbbb+0x39c)[0x7765d8124d9c]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution25computeBackedgeTakenCountEPKNS_4LoopEb+0x7f8)[0x7765d8125ff8]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution11getRangeRefEPKNS_4SCEVENS0_13RangeSignHintEj+0x60e5)[0x7765d854d1a5]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution31isKnownViaNonRecursiveReasoningENS_7CmpInst9PredicateEPKNS_4SCEVES5_+0x114)[0x7765d837466e]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution13getMinMaxExprENS_9SCEVTypesERNS_15SmallVectorImplIPKNS_4SCEVEEE+0x383)[0x7765d804b0db]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution15applyLoopGuardsEPKNS_4SCEVEPKNS_4LoopE+0xf84)[0x7765d804d104]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution12howFarToZeroEPKNS_4SCEVEPKNS_4LoopEbb+0x46e)[0x7765d863dabe]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution24computeExitLimitFromICmpEPKNS_4LoopENS_7CmpInst9PredicateEPKNS_4SCEVES8_bb+0x3f9)[0x7765d8121dff]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution28computeExitLimitFromCondImplERNS0_14ExitLimitCacheEPKNS_4LoopEPNS_5ValueEbbb+0x39c)[0x7765d8124d9c]
### recursed 9 times

/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution25computeBackedgeTakenCountEPKNS_4LoopEb+0x7f8)[0x7765d8125ff8]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution11getRangeRefEPKNS_4SCEVENS0_13RangeSignHintEj+0x60e5)[0x7765d854d1a5]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution31isKnownViaNonRecursiveReasoningENS_7CmpInst9PredicateEPKNS_4SCEVES5_+0x114)[0x7765d837466e]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution13getMinMaxExprENS_9SCEVTypesERNS_15SmallVectorImplIPKNS_4SCEVEEE+0x383)[0x7765d804b0db]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution15applyLoopGuardsEPKNS_4SCEVEPKNS_4LoopE+0xf84)[0x7765d804d104]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution12howFarToZeroEPKNS_4SCEVEPKNS_4LoopEbb+0x46e)[0x7765d863dabe]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution24computeExitLimitFromICmpEPKNS_4LoopENS_7CmpInst9PredicateEPKNS_4SCEVES8_bb+0x3f9)[0x7765d8121dff]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution28computeExitLimitFromCondImplERNS0_14ExitLimitCacheEPKNS_4LoopEPNS_5ValueEbbb+0x39c)[0x7765d8124d9c]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution25computeBackedgeTakenCountEPKNS_4LoopEb+0x7f8)[0x7765d8125ff8]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution11getRangeRefEPKNS_4SCEVENS0_13RangeSignHintEj+0x60e5)[0x7765d854d1a5]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution31isKnownViaNonRecursiveReasoningENS_7CmpInst9PredicateEPKNS_4SCEVES5_+0x114)[0x7765d837466e]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution13getMinMaxExprENS_9SCEVTypesERNS_15SmallVectorImplIPKNS_4SCEVEEE+0x383)[0x7765d804b0db]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution15applyLoopGuardsEPKNS_4SCEVEPKNS_4LoopE+0xf84)[0x7765d804d104]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution12howFarToZeroEPKNS_4SCEVEPKNS_4LoopEbb+0x46e)[0x7765d863dabe]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution24computeExitLimitFromICmpEPKNS_4LoopENS_7CmpInst9PredicateEPKNS_4SCEVES8_bb+0x3f9)[0x7765d8121dff]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution28computeExitLimitFromCondImplERNS0_14ExitLimitCacheEPKNS_4LoopEPNS_5ValueEbbb+0x39c)[0x7765d8124d9c]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution25computeBackedgeTakenCountEPKNS_4LoopEb+0x7f8)[0x7765d8125ff8]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution11getRangeRefEPKNS_4SCEVENS0_13RangeSignHintEj+0x60e5)[0x7765d854d1a5]
/home/sol/.rustup/toolchains/1.81.0-x86_64-unknown-linux-gnu/lib/libLLVM.so.18.1-rust-1.81.0-stable(_ZN4llvm15ScalarEvolution31isKnownViaNonRecursiveReasoningENS_7CmpInst9PredicateEPKNS_4SCEVES5_+0x114)[0x7765d837466e]

note: rustc unexpectedly overflowed its stack! this is a bug
note: maximum backtrace depth reached, frames may have been lost
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
note: backtrace dumped due to SIGSEGV! resuming signal
error: could not compile `agave-validator` (bin "agave-validator")

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure from the reported Cargo.toml release profile with lto enabled, using the rustc 1.81.0 environment and the provided LLVM ScalarEvolution backtrace as the entry point. Investigate the compiler or LLVM optimization path that recurses until stack exhaustion; done means the reported project compiles successfully with LTO without rustc overflowing its stack.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.