diff mbox

[committed,gcc-5-branch] Wrong stack alignment adjustment

Message ID 20151012173817.GA14451@intel.com
State New
Headers show

Commit Message

H.J. Lu Oct. 12, 2015, 5:38 p.m. UTC
Committed as an obvious fix.

H.J.
---
diff mbox

Patch

Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog	(revision 228731)
+++ gcc/ChangeLog	(working copy)
@@ -1,3 +1,10 @@ 
+2015-10-12  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR target/67940
+	* config/i386/i386.c (ix86_compute_frame_layout): Correct
+	stack alignment adjustment.
+	(ix86_expand_prologue): Likewise.
+
 2015-10-12  Uros Bizjak  <ubizjak@gmail.com>
 
 	Backport from mainline
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c	(revision 228731)
+++ gcc/config/i386/i386.c	(working copy)
@@ -10222,7 +10222,7 @@  ix86_compute_frame_layout (struct ix86_f
      sure that no value happens to be the same before and after, force
      the alignment computation below to add a non-zero value.  */
   if (stack_realign_fp)
-    offset = (offset + stack_alignment_needed) & -stack_alignment_needed;
+    offset = (offset + stack_alignment_needed - 1) & -stack_alignment_needed;
 
   /* Va-arg area */
   frame->va_arg_size = ix86_varargs_gpr_size + ix86_varargs_fpr_size;
@@ -11613,7 +11613,7 @@  ix86_expand_prologue (void)
          pointer is no longer valid.  As for the value of sp_offset,
 	 see ix86_compute_frame_layout, which we need to match in order
 	 to pass verification of stack_pointer_offset at the end.  */
-      m->fs.sp_offset = (m->fs.sp_offset + align_bytes) & -align_bytes;
+      m->fs.sp_offset = (m->fs.sp_offset + align_bytes - 1) & -align_bytes;
       m->fs.sp_valid = false;
     }