Hi,

expand_function_start failed to properly store frame pointer for
non-local goto when Pmode != ptr_mode.  OK for trunk?

Thanks.


H.J.
---
diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32
index 3405300..52ff01d 100644
--- a/gcc/ChangeLog.x32
+++ b/gcc/ChangeLog.x32
@@ -1,3 +1,9 @@
+2011-03-16  H.J. Lu  <hongjiu...@intel.com>
+
+       PR middle-end/48016
+       * function.c (expand_function_start): Properly store frame
+       pointer for non-local goto.
+
 2011-03-12  H.J. Lu  <hongjiu...@intel.com>
 
        PR target/48084
diff --git a/gcc/function.c b/gcc/function.c
index 1f7722c..1f99cb6 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4751,6 +4751,7 @@ expand_function_start (tree subr)
     {
       tree t_save;
       rtx r_save;
+      rtx frame_pointer;
 
       /* ??? We need to do this save early.  Unfortunately here is
         before the frame variable gets declared.  Help out...  */
@@ -4762,9 +4763,14 @@ 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);
 
-      emit_move_insn (r_save, targetm.builtin_setjmp_frame_value ());
+      /* We are storing frame pointer in R_SAVE here.  */
+      frame_pointer = targetm.builtin_setjmp_frame_value ();
+      if (GET_MODE (frame_pointer) != GET_MODE (r_save))
+       frame_pointer = convert_to_mode (GET_MODE (r_save),
+                                        frame_pointer, 1);
+
+      emit_move_insn (r_save, frame_pointer);
       update_nonlocal_goto_save_area ();
     }
 

Reply via email to