public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH [5/n]: Prepare x32: PR middle-end/48016: Inconsistency in non-local goto save area
@ 2011-06-11 16:22 H.J. Lu
  2011-06-15 14:37 ` Michael Matz
  0 siblings, 1 reply; 11+ messages in thread
From: H.J. Lu @ 2011-06-11 16:22 UTC (permalink / raw)
  To: gcc-patches

Hi,

We are very inconsistent when saving and restoring non-local goto save
area.  See:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48016

for detailed analysis.  OK for trunk?

Thanks.


H.J.
---
2011-06-07  H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/48016
	* explow.c (emit_stack_save): Adjust mode of stack save area.

	* function.c (expand_function_start): Properly store frame
	pointer for non-local goto.

diff --git a/gcc/explow.c b/gcc/explow.c
index 7387dad..b343bf8 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -1035,6 +1030,14 @@ emit_stack_save (enum save_level save_level, rtx *psave)
   do_pending_stack_adjust ();
   if (sa != 0)
     sa = validize_mem (sa);
+  /* FIXME: update_nonlocal_goto_save_area may pass SA in the wrong mode.  */
+  if (GET_MODE (sa) != mode)
+    {
+      gcc_assert (ptr_mode != Pmode
+		  && GET_MODE (sa) == ptr_mode
+		  && mode == Pmode);
+      sa = adjust_address (sa, mode, 0); 
+    }
   emit_insn (fcn (sa, stack_pointer_rtx));
 }
 
diff --git a/gcc/function.c b/gcc/function.c
index 30cc9ff..47fd5b7 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4779,7 +4779,7 @@ expand_function_start (tree subr)
 		       cfun->nonlocal_goto_save_area,
 		       integer_zero_node, NULL_TREE, NULL_TREE);
       r_save = expand_expr (t_save, NULL_RTX, VOIDmode, EXPAND_WRITE);
-      r_save = convert_memory_address (Pmode, r_save);
+      r_save = adjust_address (r_save, Pmode, 0);
 
       emit_move_insn (r_save, targetm.builtin_setjmp_frame_value ());
       update_nonlocal_goto_save_area ();

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-07-01  8:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-11 16:22 PATCH [5/n]: Prepare x32: PR middle-end/48016: Inconsistency in non-local goto save area H.J. Lu
2011-06-15 14:37 ` Michael Matz
2011-06-15 15:10   ` H.J. Lu
     [not found]     ` <Pine.LNX.4.64.1106151659200.17115@wotan.suse.de>
2011-06-16  6:41       ` H.J. Lu
2011-06-16  8:02         ` Richard Guenther
2011-06-16 17:59           ` H.J. Lu
2011-06-25 16:20             ` H.J. Lu
2011-06-29 15:25               ` H.J. Lu
2011-06-29 17:03                 ` Michael Matz
2011-06-30 18:10                   ` H.J. Lu
2011-07-01  8:01                     ` Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).