The following testcase doesn't contain DW_AT_const_value for arrg3 nor min when early inlining is used, while when normal inlining is performed all is fine. -g -O2 --param early-inlining-insns=32 (doesn't work) vs. -g -O2 --param early-inlining-insns=32 -fno-early-inlining Sorry for the extra parameter, but the testcase was reported against 4.4-RH which does 4.4-ish inlining decisions, so it needs some tweaks to get the same effect in 4.5. For arrg3, there are DEBUG stmts (and even var-tracking produces locations for it), but dwarf2out ignores them, as the var has been non-localized (var_ann has been NULL). For min argument, a DEBUG stmt only appears when not using early inlining.
Created attachment 20078 [details] rh572260.ii Testcase.
The problem is that with early inlining, method (&inst, 24) call is inlined into call function, then at the end of einline during arrg3 and min vars in call are removed as unused locals by remove_unused_locals (the inline asm uses 24 directly, so arrg3 is only referenced in DEBUG stmts, not sure why min didn't have any DEBUG stmts even generated). Then when in the normal inliner call is inlined into main, both arrg3 and min are non-localized because their var_ann is NULL. And for non-localized vars dwarf2out isn't able to find the dwarf2out_var_location tracked values.
Wonder why we do 548 VEC_safe_push (tree, gc, *nonlocalized_list, origin_var); instead of 548 VEC_safe_push (tree, gc, *nonlocalized_list, old_var); The latter perhaps would need some adjustments in dwarf2out.c, but would allow it to find the location.
Created attachment 20081 [details] gcc45-pr43329.patch This patch worked on this testcase. Note that the missing min (and this) DEBUG stmts are caused by remove_forwarder_block nuking it. Looking into that...
Created attachment 20084 [details] gcc45-pr43329.patch Updated patch that also fixes remove_forwarder_block and adds a testcase.
Subject: Bug 43329 Author: jakub Date: Fri Mar 12 13:04:37 2010 New Revision: 157402 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157402 Log: PR debug/43329 * tree-inline.c (remap_decls): Put old_var rather than origin_var into *nonlocalized_list vector. * dwarf2out.c (gen_formal_parameter_die): Call decl_ultimate_origin even if origin is non-NULL. (gen_variable_die): Likewise. (process_scope_var): Don't change origin. (gen_decl_die): Likewise. * tree-cfgcleanup.c (remove_forwarder_block): Check single_pred_p before adding new edges instead of after it, fix moving over debug stmts. * gcc.dg/guality/pr43329-1.c: New test. Added: trunk/gcc/testsuite/gcc.dg/guality/pr43329-1.c Modified: trunk/gcc/ChangeLog trunk/gcc/dwarf2out.c trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-cfgcleanup.c trunk/gcc/tree-inline.c
Fixed.