Skip to content

segmentation fault #133922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wxie7 opened this issue Dec 5, 2024 · 1 comment
Closed

segmentation fault #133922

wxie7 opened this issue Dec 5, 2024 · 1 comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@wxie7
Copy link

wxie7 commented Dec 5, 2024

I tried this code:

rustc --crate-type staticlib -C link-dead-code -C debuginfo=2 file.rs
use std::mem::ManuallyDrop;
pub enum Foo<U> {
    Leaf(U),
    Branch(BoxedFoo<BoxedFoo<U>>),
}
pub type BoxedFoo<U> = ManuallyDrop<Box<Foo<U>>>;
pub fn drop() -> Foo<usize> {
    todo!()
}

Meta

rustc --version --verbose:

rustc 1.85.0-nightly (acabb5248 2024-12-04)
binary: rustc
commit-hash: acabb5248231987ae1f0c215208d1005a5db402d
commit-date: 2024-12-04
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.5
Backtrace

warning: variant `Recursive` is never constructed
 --> mutant.rs:3:5
  |
1 | enum Foo<T: 'static> {
  |      --- variant in this enum
2 |     Value(T),
3 |     Recursive(&'static Foo<Option<T>>),
  |     ^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

error: rustc interrupted by SIGSEGV, printing backtrace

/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x36d7fa3)[0x7926f32d7fa3]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7926ef842520]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(_RNvNtNtCskYQ3m3XnxIX_17rustc_codegen_ssa9debuginfo10type_names14push_item_name+0x9)[0x7926f4812b09]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(_RNvNtNtCskYQ3m3XnxIX_17rustc_codegen_ssa9debuginfo10type_names14push_item_name+0x1b3)[0x7926f4812cb3]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(_RNvNtNtCskYQ3m3XnxIX_17rustc_codegen_ssa9debuginfo10type_names14push_item_name+0x1b3)[0x7926f4812cb3]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x5198b39)[0x7926f4d98b39]

### cycle encountered after 6 frames with period 7
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
### recursed 35 times

/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]

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
[1]    430090 segmentation fault (core dumped)  rustc -C link-dead-code -C debuginfo=2 mutant.rs

@wxie7 wxie7 added the C-bug Category: This is a bug. label Dec 5, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 5, 2024
@saethlin saethlin added I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Dec 5, 2024
@jieyouxu jieyouxu added the A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) label Dec 5, 2024
@saethlin
Copy link
Member

saethlin commented Dec 5, 2024

I'm pretty sure that this is a duplicate of #133920. These two examples are just using different ways to get a recursive type through the other parts of the compiler that normally fall over on them, then using different mechanisms to expose the type to debuginfo generation. Either constructing one in fn main in a bin crate, or using one in a function signature with -Clink-dead-code.

@saethlin saethlin closed this as completed Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants