Skip to content

Commit 15b7a08

Browse files
committed
Fix unwinding when debug assertions are enabled
This came up on armv7-apple-ios when using -Zbuild-std
1 parent 211637d commit 15b7a08

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)