Message ID | 20110611160548.GA20036@intel.com |
---|---|
State | New |
Headers | show |
Hi, On Sat, 11 Jun 2011, H.J. Lu wrote: > 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? > + /* 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); > + } That may be appropriate for a branch, but trunk shouldn't contain FIXMEs that explain how something should be fixed, instead that something should be carried out. I.e. just fix update_nonlocal_goto_save_area. Ciao, Michael.
On Wed, Jun 15, 2011 at 7:11 AM, Michael Matz <matz@suse.de> wrote: > Hi, > > On Sat, 11 Jun 2011, H.J. Lu wrote: > >> 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? >> + /* 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); >> + } > > That may be appropriate for a branch, but trunk shouldn't contain FIXMEs > that explain how something should be fixed, instead that something should > be carried out. I.e. just fix update_nonlocal_goto_save_area. > I don't know update_nonlocal_goto_save_area enough to fix it without breaking other targets. This patch is the lest invasive. Any suggestions how to properly fix it is appreciated. Thanks.
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 ();