On Wed, Jun 15, 2011 at 9:55 PM, H.J. Lu <hjl.to...@gmail.com> wrote: > On Wed, Jun 15, 2011 at 8:16 AM, Michael Matz <m...@suse.de> wrote: >> Hi, >> >> On Wed, 15 Jun 2011, H.J. Lu wrote: >> >>> >> + /* 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. >> >> Well, the most obvious variant would be to move the above code right >> before the call of emit_stack_save in update_nonlocal_goto_save_area >> (using r_save and STACK_SAVEAREA_MODE (SAVE_NONLOCAL)). All other callers >> of emit_stack_save already make sure to pass an object of correct mode, so >> this one should too. >> >> But I think it's better to just produce a correct array_ref from the >> start. get_nl_goto_field creates an array_type for the >> nonlocal_goto_save_area of correct type (ptr_type_node or >> lang_hooks.types.type_for_mode (Pmode, 1)), and we should use that. >> >> So something like this in update_nonlocal_goto_save_area: >> t_save = build4 (ARRAY_REF, >> TREE_TYPE (TREE_TYPE (cfun->nonlocal_goto_save_area)), >> cfun->nonlocal_goto_save_area, >> integer_one_node, NULL_TREE, NULL_TREE); >> >> instead of the current building of t_save. Then r_save also should get >> the correct mode automatically. >> > > Here is the updated patch. OK for trunk?
The explow.c change is ok. For the function.c change I wonder why convert_memory_address doesn't do the right thing - from it's documentation it definitely should, so it should be fixed instead of being replaced by adjust_address with a zero offset. Richard. > Thanks. > > -- > H.J. > --- > 2011-06-15 H.J. Lu <hongjiu...@intel.com> > > PR middle-end/48016 > * explow.c (update_nonlocal_goto_save_area): Use proper mode > for stack save area. > > * function.c (expand_function_start): Properly store frame > pointer for non-local goto. >