This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug bootstrap/77359] [7 Regression] AIX bootstrap failure due to alignment of stack pointer + STACK_DYNAMIC_OFFSET


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

--- Comment #8 from Dominik Vogt <vogt at linux dot vnet.ibm.com> ---
Something like this:

-- snip --
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 353f388..3158c24 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -1719,6 +1719,11 @@ extern enum reg_class
rs6000_constraints[RS6000_CONSTRAINT_MAX];
                    (TARGET_ALTIVEC || TARGET_VSX) ? 16 : 8)            \
       + RS6000_SAVE_AREA))

+/* Rounds up BYTE_SIZE (in bytes) to the guaranteed alignment of the dynamic
+   stack offset.  */
+#define STACK_DYNAMIC_OFFSET_ALIGN(byte_size) \
+  (RS6000_ALIGN (byte_size, (TARGET_ALTIVEC || TARGET_VSX) ? 16 : 8))
+
 /* Offset from the stack pointer register to an item dynamically
    allocated on the stack, e.g., by `alloca'.

@@ -1726,9 +1731,8 @@ extern enum reg_class
rs6000_constraints[RS6000_CONSTRAINT_MAX];
    length of the outgoing arguments.  The default is correct for most
    machines.  See `function.c' for details.  */
 #define STACK_DYNAMIC_OFFSET(FUNDECL)                                  \
-  (RS6000_ALIGN (crtl->outgoing_args_size,                             \
-                (TARGET_ALTIVEC || TARGET_VSX) ? 16 : 8)               \
-   + (STACK_POINTER_OFFSET))
+  (STACK_DYNAMIC_OFFSET_ALIGN(crtl->outgoing_args_size)                       
\
+   (STACK_POINTER_OFFSET))

 /* If we generate an insn to push BYTES bytes,
    this says how many the stack pointer really advances by.
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 99f052d..5ec68ae 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -5717,6 +5717,13 @@ init_emit (void)
   REGNO_POINTER_ALIGN (VIRTUAL_CFA_REGNUM) = BITS_PER_WORD;
 #endif

+#ifdef STACK_DYNAMIC_OFFSET_ALIGN
+  REGNO_POINTER_ALIGN (VIRTUAL_STACK_DYNAMIC_REGNUM) =
+    STACK_DYNAMIC_OFFSET_ALIGN (1);
+  gcc_assert (REGNO_POINTER_ALIGN (VIRTUAL_STACK_DYNAMIC_REGNUM)
+             <= REGNO_POINTER_ALIGN (STACK_POINTER_REGNUM));
+#endif
+
 #ifdef INIT_EXPANDERS
   INIT_EXPANDERS;
 #endif
-- snip --

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]