aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Hastings <stuart@apple.com>2006-03-09 00:45:38 +0000
committerStuart Hastings <stuart@apple.com>2006-03-09 00:45:38 +0000
commitf8b6ef368db303353d265e429a2b15ea245c38cb (patch)
tree039641296667850a9c0d697aebf11582ccb2cfee
parent94eebe6c58f1469918901c3b10f80cd4f3d6b060 (diff)
Radar 4457939
* gcc/config/i386/i386.c (ix86_darwin_init_expanders): New. * gcc/config/i386/darwin.h (ix86_darwin_init_expanders): Declare. (INIT_EXPANDERS): Define. * gcc.apple/4457939.c: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/apple-local-200502-branch@111857 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.apple-ppc7
-rw-r--r--gcc/config/i386/darwin.h9
-rw-r--r--gcc/config/i386/i386.c24
-rw-r--r--gcc/testsuite/ChangeLog.apple-ppc7
-rwxr-xr-xgcc/testsuite/gcc.apple/4457939.c22
5 files changed, 68 insertions, 1 deletions
diff --git a/gcc/ChangeLog.apple-ppc b/gcc/ChangeLog.apple-ppc
index 2c622eb3269..683107a05cb 100644
--- a/gcc/ChangeLog.apple-ppc
+++ b/gcc/ChangeLog.apple-ppc
@@ -1,3 +1,10 @@
+2006-03-07 Stuart Hastings <stuart@apple.com>
+
+ Radar 4457939
+ * gcc/config/i386/i386.c (ix86_darwin_init_expanders): New.
+ * gcc/config/i386/darwin.h (ix86_darwin_init_expanders): Declare.
+ (INIT_EXPANDERS): Define.
+
2006-03-07 Mike Stump <mrs@apple.com>
Radar 4408780
diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h
index df376659f95..e984584c0a6 100644
--- a/gcc/config/i386/darwin.h
+++ b/gcc/config/i386/darwin.h
@@ -271,3 +271,12 @@ extern int flag_cw_asm_blocks;
: (n) >= 11 && (n) <= 18 ? (n) + 1 \
: (n))
/* APPLE LOCAL end mainline 2006-02-21 4439051 */
+
+/* APPLE LOCAL begin 4457939 stack alignment mishandled */
+/* <rdar://problem/4471596> stack alignment is not handled properly
+
+ Please remove this entire a**le local when addressing this
+ Radar. */
+extern void ix86_darwin_init_expanders (void);
+#define INIT_EXPANDERS (ix86_darwin_init_expanders ())
+/* APPLE LOCAL end 4457939 stack alignment mishandled */
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 8e095097905..b7ac5472b9d 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -17081,6 +17081,30 @@ darwin_x86_file_end (void)
ix86_file_end ();
}
/* APPLE LOCAL end deep branch prediction pic-base */
+
+/* APPLE LOCAL begin 4457939 stack alignment mishandled */
+void
+ix86_darwin_init_expanders (void)
+{
+ /* <rdar://problem/4471596> stack alignment is not handled properly
+
+ Please remove this entire function when addressing this
+ Radar. Please be sure to delete the definition of INIT_EXPANDERS
+ in i386/darwin.h as well. */
+ /* Darwin/x86_32 stack pointer will be 16-byte aligned at every
+ CALL, but the frame pointer, when used, will be 8-bytes offset
+ from a 16-byte alignment (the size of the return address and the
+ saved frame pointer). */
+ if (cfun && cfun->emit
+ && cfun->emit->regno_pointer_align)
+ {
+ REGNO_POINTER_ALIGN (STACK_POINTER_REGNUM) = STACK_BOUNDARY;
+ REGNO_POINTER_ALIGN (FRAME_POINTER_REGNUM) = BITS_PER_WORD;
+ REGNO_POINTER_ALIGN (HARD_FRAME_POINTER_REGNUM) = BITS_PER_WORD;
+ REGNO_POINTER_ALIGN (ARG_POINTER_REGNUM) = BITS_PER_WORD;
+ }
+}
+/* APPLE LOCAL end 4457939 stack alignment mishandled */
#endif /* TARGET_MACHO */
/* Order the registers for register allocator. */
diff --git a/gcc/testsuite/ChangeLog.apple-ppc b/gcc/testsuite/ChangeLog.apple-ppc
index 4a3ffaa727e..20280ec6f17 100644
--- a/gcc/testsuite/ChangeLog.apple-ppc
+++ b/gcc/testsuite/ChangeLog.apple-ppc
@@ -1,3 +1,8 @@
+2006-03-07 Stuart Hastings <stuart@apple.com>
+
+ Radar 4457939
+ * dg.apple/4457979.c: New.
+
2006-03-07 Mike Stump <mrs@apple.com>
Radar 4408780
@@ -6,7 +11,7 @@
2006-03-03 Stuart Hastings <stuart@apple.com>
- * Radar 4425360
+ Radar 4425360
* g++.dg/4425360.C: New.
2006-02-28 Devang Patel <dpatel@apple.com>
diff --git a/gcc/testsuite/gcc.apple/4457939.c b/gcc/testsuite/gcc.apple/4457939.c
new file mode 100755
index 00000000000..e5441d0de72
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/4457939.c
@@ -0,0 +1,22 @@
+/* APPLE LOCAL file 4457939 stack alignment mishandled */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+#include <inttypes.h>
+#include <stdlib.h>
+
+#define ALIGN_PTR(p,a) ((void *)( (((size_t)(p))+(a)-1)&~((size_t)(a)-1)))
+
+void __attribute__ ((__noinline__))
+foo (void *v)
+{
+ if (((size_t)v) & 15)
+ abort ();
+}
+
+int
+main (void)
+{
+ float x[13];
+ foo (ALIGN_PTR (x, 16));
+ return 0;
+}