-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Segfault in safe code that spawns a thread with an infinite loop when optimized #39753
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
Comments
The original poster there also had this backtrace:
|
LLDB (without debugging symbols) says:
|
Setting a breakpoint on
|
@rkruppe certainly seems related, but there's no |
However, I've got a fresh build going, so I can check in a little bit. |
Some disassembly:
The The registers:
|
Valgrind output (code compiled with Rust 1.15.1):
|
Oh, right, |
A shorter version also crashes: use std::thread;
fn main() {
thread::spawn(|| {
loop {}
}).join();
} But, it works well if I add use std::thread;
fn main() {
thread::spawn(|| {
loop {
println!("123");
}
}).join();
} |
In Linux, against ba7cf7c, the code no longer segfaults, but it does panic:
And Valgrind is still unhappy about it:
|
Dup of #28728 |
Agreed. The LLVM IR has the same telltale sign: ; Function Attrs: norecurse noreturn nounwind readnone uwtable
define internal void @_ZN3std9panicking3try7do_call17hf7fda4c0bc0de239E(i8* nocapture) unnamed_addr #1 personality i32 (i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*)* @rust_eh_personality {
entry-block:
unreachable
} |
Summary
Complete original report
Originally reported on Stack Overflow.
Adding an
unwrap()
does not change the behavior.The text was updated successfully, but these errors were encountered: