On Wed, Jun 20, 2018 at 12:25 AM Eric Botcazou <ebotca...@adacore.com> wrote: > > Hi, > > the Ada compiler uses small functions defined in its runtime to implement > various intrinsic operations and it always inlines them, even at -O0. But it > doesn't want location information from the runtime files to appear in the > debug info so it puts DECL_IGNORED_P on these functions. final.c already > knows not to generate location information for DECL_IGNORED_P functions when > they are standalone but that's not the case for the inliner, i.e. it leaks > location information from these functions where they are inlined. > > The attached patch is aimed at preventing this from happening by explicitly > putting input_location on the inlined bodies, adjusting the locations on debug > statements, as well as a few other adjustements. > > Tested (GCC and GDB) on x86-64/Linux, OK for the mainline?
There are fixes in this patch together with the new functionality - can you split those out? I'm thinking of the copy_edges_for_bb hunks as well as the expand_call_inline ones. As for the real change I'd prefer to not repeat the DECL_INGORED_P checks but instead have a id->remap_location flag and a id->call_location that locations are remapped to (to not sprinkle more input_location uses in the code). Also in case the call location is UNKNOWN_LOCATION do we at least want to use a location that has the encompaning BLOCK recorded? Thanks, Richard. > > 2018-06-19 Eric Botcazou <ebotca...@adacore.com> > > * tree-inline.c (remap_location): New function extracted from... > (remap_gimple_stmt): Force input_location on the copy if > DECL_IGNORED_P > is set on the source function. > (copy_edges_for_bb): Add ID parameter. Copy locus and remap block of > edges if DECL_IGNORED_P isn't set on the source function. > (copy_phis_for_bb): ...here. Do not copy locus of arguments if > DECL_IGNORED_P is set on the source function. > (maybe_move_debug_stmts_to_successors): Also reset the locus of the > debug statement when resetting its value. > (copy_cfg_body): Adjust call to copy_edges_for_bb. > (expand_call_inline): Copy the locus of the call onto the assignment > of > the return value, if any. Use local variable in more cases. > > > 2018-06-19 Eric Botcazou <ebotca...@adacore.com> > > * gnat.dg/debug15.adb: New test. > > -- > Eric Botcazou