+2015-07-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/66906
+ * config/i386/i386.c (ix86_expand_prologue): Replicate static
+ chain on the stack.
+
2015-07-17 Nathan Sidwell <nathan@codesourcery.com>
* config/nvptx/mkoffload.c (process): Constify host data.
HOST_WIDE_INT allocate;
bool int_registers_saved;
bool sse_registers_saved;
+ rtx static_chain = NULL_RTX;
ix86_finalize_stack_realign_flags ();
call. This insn will be skipped by the trampoline. */
else if (ix86_static_chain_on_stack)
{
- insn = emit_insn (gen_push (ix86_static_chain (cfun->decl, false)));
+ static_chain = ix86_static_chain (cfun->decl, false);
+ insn = emit_insn (gen_push (static_chain));
emit_insn (gen_blockage ());
/* We don't want to interpret this push insn as a register save,
we've started over with a new frame. */
m->fs.sp_offset = INCOMING_FRAME_SP_OFFSET;
m->fs.realigned = true;
+
+ if (static_chain)
+ {
+ /* Replicate static chain on the stack so that static chain
+ can be reached via (argp - 2) slot. This is needed for
+ nested function with stack realignment. */
+ insn = emit_insn (gen_push (static_chain));
+ RTX_FRAME_RELATED_P (insn) = 1;
+ }
}
int_registers_saved = (frame.nregs == 0);
+2015-07-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/66906
+ * gcc.target/i386/pr66906.c: New test.
+
2015-07-17 Mikael Morin <mikael@gcc.gnu.org>
* gfortran.dg/coarray_collectives_16.f90: Fix pattern
--- /dev/null
+/* { dg-do run { target ia32 } } */
+/* { dg-options "-O0 -mregparm=3" } */
+
+typedef int ptrdiff_t;
+extern void abort (void);
+int
+check_int (int *i, int align)
+{
+ *i = 20;
+ if ((((ptrdiff_t) i) & (align - 1)) != 0)
+ abort ();
+ return *i;
+}
+void
+check (void *p, int align)
+{
+ if ((((ptrdiff_t) p) & (align - 1)) != 0)
+ abort ();
+}
+typedef int aligned __attribute__((aligned(64)));
+void
+foo (void)
+{
+ aligned j;
+ void bar ()
+ {
+ aligned i;
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+ if (check_int (&j, __alignof__(j)) != j)
+ abort ();
+ j = -20;
+ }
+ bar ();
+ if (j != -20)
+ abort ();
+ if (check_int (&j, __alignof__(j)) != j)
+ abort ();
+}
+int
+main()
+{
+ foo ();
+ return 0;
+}