File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -609,10 +609,21 @@ when unwinding through __morestack).
609609void
610610rust_task::reset_stack_limit () {
611611 uintptr_t sp = get_sp ();
612+ bool reseted = false ;
612613 while (!sp_in_stk_seg (sp, stk)) {
614+ reseted = true ;
613615 prev_stack ();
614616 assert (stk != NULL && " Failed to find the current stack" );
615617 }
618+
619+ // Each call to prev_stack will record the stack limit. If we *didn't*
620+ // call prev_stack then we still need to record it now to catch a corner case:
621+ // the throw to initiate unwinding starts on the C stack while sp limit is 0.
622+ // If we don't set the limit here then the rust code run subsequently will
623+ // will veer into the red zone. Lame!
624+ if (!reseted) {
625+ record_stack_limit ();
626+ }
616627}
617628
618629void
Original file line number Diff line number Diff line change 88// option. This file may not be copied, modified, or distributed
99// except according to those terms.
1010
11- // xfail-test
11+ // xfail-fast
12+
1213extern mod extra;
1314
1415use std:: comm:: * ;
You can’t perform that action at this time.
0 commit comments