pa.c (hppa_expand_prologue): Avoid writing outside the current stack boundary in...
authorJeff Law <law@gcc.gnu.org>
Mon, 15 Aug 1994 01:55:59 +0000 (19:55 -0600)
committerJeff Law <law@gcc.gnu.org>
Mon, 15 Aug 1994 01:55:59 +0000 (19:55 -0600)
* pa.c (hppa_expand_prologue): Avoid writing outside the current
stack boundary in code to handle large stack frames.

From-SVN: r7926

gcc/config/pa/pa.c

index 2ec1d8b33e523acf7939d4009118455f86c57718..6adca1b23b8b5ca418dec449f0308360986b9656 100644 (file)
@@ -2090,10 +2090,18 @@ hppa_expand_prologue()
                                    size_rtx, tmpreg));
        else
          {
-           store_reg (1, 0, FRAME_POINTER_REGNUM);
+           /* It is incorrect to store the saved frame pointer at *sp,
+              then increment sp (writes beyond the current stack boundary).
+
+              So instead use stwm to store at *sp and post-increment the
+              stack pointer as an atomic operation.  Then increment sp to
+              finish allocating the new frame.  */
+           emit_insn (gen_post_stwm (stack_pointer_rtx,
+                                     stack_pointer_rtx,
+                                     GEN_INT (64), tmpreg));
            set_reg_plus_d (STACK_POINTER_REGNUM,
                            STACK_POINTER_REGNUM,
-                           actual_fsize);
+                           actual_fsize - 64);
          }
       }
     /* no frame pointer needed.  */