This is the mail archive of the gcc-patches@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]

[PATCH] Fix PR middle-end/17813


Hi,

This is the Ada compiler bootstrap failure on i586 and below, which again 
pertains to stack adjustments.  cstand.adb:Create_Standard is miscompiled 
because a stack adjustment is emitted right after a __builtin_stack_restore.

The proposed fix is to emit pending stack adjustments right before 
__builtin_stack_save and __builtin_stack_restore.  Bootstrapped on 
i586-mandrake-linux-gnu (with the workaround for PR tree-opt/17986).
OK for mainline?


2004-10-16 ?Eric Botcazou ?<ebotcazou@libertysurf.fr>

	PR middle-end/17813
	* explow.c (emit_stack_save): Emit pending stack adjustments.
	(emit_stack_restore): Likewise.


-- 
Eric Botcazou

Index: explow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/explow.c,v
retrieving revision 1.139
diff -u -p -r1.139 explow.c
--- explow.c	8 Sep 2004 08:05:13 -0000	1.139
+++ explow.c	16 Oct 2004 16:41:55 -0000
@@ -965,6 +965,7 @@ emit_stack_save (enum save_level save_le
       rtx seq;
 
       start_sequence ();
+      do_pending_stack_adjust ();
       /* We must validize inside the sequence, to ensure that any instructions
 	 created by the validize call also get moved to the right place.  */
       if (sa != 0)
@@ -976,6 +977,7 @@ emit_stack_save (enum save_level save_le
     }
   else
     {
+      do_pending_stack_adjust ();
       if (sa != 0)
 	sa = validize_mem (sa);
       emit_insn (fcn (sa, stack_pointer_rtx));
@@ -1037,13 +1039,17 @@ emit_stack_restore (enum save_level save
       rtx seq;
 
       start_sequence ();
+      do_pending_stack_adjust ();
       emit_insn (fcn (stack_pointer_rtx, sa));
       seq = get_insns ();
       end_sequence ();
       emit_insn_after (seq, after);
     }
   else
-    emit_insn (fcn (stack_pointer_rtx, sa));
+    {
+      do_pending_stack_adjust ();
+      emit_insn (fcn (stack_pointer_rtx, sa));
+    }
 }
 
 /* Invoke emit_stack_save on the nonlocal_goto_save_area for the current

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