On Sun, Sep 20, 2009 at 1:18 PM, Maxim Kuvyrkov <ma...@codesourcery.com> wrote: > Richard Guenther wrote: >> >> On Sun, Sep 20, 2009 at 9:38 AM, Maxim Kuvyrkov <ma...@codesourcery.com> >> wrote: > > ... >>> >>> This code uses eliminate_regs(), which implicitly assumes >>> reload_completed >>> as it uses reg_eliminate[], which assumes that frame_pointer_needed is >>> properly set, which happens in ira.c. However, in some cases this piece >>> of >>> based_loc_descr() can be reached during inlining pass (see backtrace >>> below). >>> When called before reload, eliminate_regs() may return an inconsistent >>> result which is why the assert in based_loc_descr() fails. In the >>> particular testcase I'm investigating, frame_pointer_needed is 0 (initial >>> value), but eliminate_regs returns stack_pointer_rtx because it is guided >>> by >>> reg_eliminate information from the previous function which had >>> frame_pointer_needed set to 1. > > ... >> >> I think you should avoid calling eliminate_regs for DECL_ABSTRACT >> current_function_decl. That should cover the inliner path. > > Thanks for the insight. Do you mean something like the attached patch?
Yes, though we should probably try to catch the DECL_ABSTRACT case further up the call chain - there shouldn't be any location lists for abstract function. Thus, see why static dw_die_ref gen_formal_parameter_die (tree node, tree origin, dw_die_ref context_die) ... if (! DECL_ABSTRACT (node_or_origin)) add_location_or_const_value_attribute (parm_die, node_or_origin, DW_AT_location); the node_or_origin of the param isn't DECL_ABSTRACT. In the end the above check should have avoided the situation you run into. Richard.