diff --git a/cranelift/codegen/src/isa/aarch64/inst/unwind.rs b/cranelift/codegen/src/isa/aarch64/inst/unwind.rs index 265dd3fb60ce..ff6634ad47b6 100644 --- a/cranelift/codegen/src/isa/aarch64/inst/unwind.rs +++ b/cranelift/codegen/src/isa/aarch64/inst/unwind.rs @@ -102,7 +102,12 @@ impl UnwindInfoGenerator for AArch64UnwindInfo { // TODO epilogues - let prologue_size = context.insts_layout[context.prologue.end as usize - 1]; + let prologue_size = if context.prologue.is_empty() { + 0 + } else { + context.insts_layout[context.prologue.end as usize - 1] + }; + Ok(Some(UnwindInfo { prologue_size, prologue_unwind_codes: codes,