Skip to content

Commit c98e893

Browse files
authored
Rollup merge of #99932 - madsmtm:fix-unwinding-debug-assertions, r=Amanieu
Fix unwinding on certain platforms when debug assertions are enabled This came up on `armv7-apple-ios` when using `-Zbuild-std`. Looks like this is a leftover from a [conversion from C to Rust](051c2d1), where integer wrapping is implicit. Not at all sure how the unwinding code works!
2 parents 9cc06eb + 15b7a08 commit c98e893

File tree

1 file changed

+3
-1
lines changed
  • library/panic_unwind/src

1 file changed

+3
-1
lines changed

library/panic_unwind/src/gcc.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ unsafe fn find_eh_action(context: *mut uw::_Unwind_Context) -> Result<EHAction,
306306
let eh_context = EHContext {
307307
// The return address points 1 byte past the call instruction,
308308
// which could be in the next IP range in LSDA range table.
309-
ip: if ip_before_instr != 0 { ip } else { ip - 1 },
309+
//
310+
// `ip = -1` has special meaning, so use wrapping sub to allow for that
311+
ip: if ip_before_instr != 0 { ip } else { ip.wrapping_sub(1) },
310312
func_start: uw::_Unwind_GetRegionStart(context),
311313
get_text_start: &|| uw::_Unwind_GetTextRelBase(context),
312314
get_data_start: &|| uw::_Unwind_GetDataRelBase(context),

0 commit comments

Comments
 (0)