The following patch fixes all s390 GCC testsuite failures (in comparison with reloads). The problem was in unaligned access in a shared library code which was result of unaligned stack of generated code.

The patch was also successfully bootstrapped on x86/x86-64.

Committed as rev. 196685.

2013-03-15  Vladimir Makarov <vmaka...@redhat.com>

        * lra.c (lra): Align non-empty stack frame.
        * lra-spills.c (lra_spill): Align stack after spilling pseudos.

Index: ChangeLog
===================================================================
--- ChangeLog   (revision 196598)
+++ ChangeLog   (working copy)
@@ -1,3 +1,8 @@
+2013-03-15  Vladimir Makarov  <vmaka...@redhat.com>
+
+       * lra.c (lra): Allign non-empty stack frame.
+       * lra-spills.c (lra_spill): Allign stack after spilling pseudos.
+
 2013-03-08  Vladimir Makarov  <vmaka...@redhat.com>
 
        * lra-constraints.c (process_alt_operands): Don't penalize
Index: lra-spills.c
===================================================================
--- lra-spills.c        (revision 196598)
+++ lra-spills.c        (working copy)
@@ -548,6 +548,11 @@ lra_spill (void)
   for (i = 0; i < n; i++)
     if (pseudo_slots[pseudo_regnos[i]].mem == NULL_RTX)
       assign_mem_slot (pseudo_regnos[i]);
+  if (n > 0 && crtl->stack_alignment_needed)
+    /* If we have a stack frame, we must align it now.  The stack size
+       may be a part of the offset computation for register
+       elimination.  */
+    assign_stack_local (BLKmode, 0, crtl->stack_alignment_needed);
   if (lra_dump_file != NULL)
     {
       for (i = 0; i < slots_num; i++)
Index: lra.c
===================================================================
--- lra.c       (revision 196598)
+++ lra.c       (working copy)
@@ -2272,6 +2272,11 @@ lra (FILE *f)
   bitmap_initialize (&lra_split_regs, &reg_obstack);
   bitmap_initialize (&lra_optional_reload_pseudos, &reg_obstack);
   live_p = false;
+  if (get_frame_size () != 0 && crtl->stack_alignment_needed)
+    /* If we have a stack frame, we must align it now.  The stack size
+       may be a part of the offset computation for register
+       elimination.  */
+    assign_stack_local (BLKmode, 0, crtl->stack_alignment_needed);
   for (;;)
     {
       for (;;)

Reply via email to