https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128270

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
Some more debugging resulted in:

--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ ix86_add_cfa_restore_note (rtx_insn *insn, rtx reg, HOST_WIDE_INT
cfa_offset)
 {
-  if (!crtl->shrink_wrapped
+  /* In a DRAP-realigned frame, the saved hard frame pointer (dwarf2cfi
+     Rule 18) and registers saved by moves (see
+     ix86_emit_save_reg_using_mov) are described by DW_CFA_expression
+     rules relative to the frame pointer itself.  Those rules are wrong
+     once the frame pointer is restored, even if the saved value is
+     untouched in the red zone, so don't skip the restore note.  */
+  if (!stack_realign_drap
+      && !crtl->shrink_wrapped
       && cfa_offset <= cfun->machine->fs.red_zone_offset)
     return;

Reply via email to