[patch] Do not leak location information during inlining (2nd try)

Eric Botcazou ebotcazou@adacore.com
Wed Jun 27 13:26:00 GMT 2018


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 how 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 
forcing input_location on the inlined bodies in this case.

Tested (GCC and GDB) on x86-64/Linux, OK for the mainline?


2018-06-27  Eric Botcazou  <ebotcazou@adacore.com>

	* tree-inline.c (remap_gimple_stmt): Force input_location on the new
	statement if id->reset_location is true.
	(copy_edges_for_bb): Do not set goto_locus on the new edges if
	id->reset_location is true.
	(copy_phis_for_bb): Force input_location on the arguments if
	id->reset_location is true.
	(expand_call_inline): Set id->reset_location if DECL_IGNORED_P
	is set on the function to be inlined.
	* tree-inline.h (struct copy_body_data): Move remapping_type_depth and
	prevent_decl_creation_for_types fields up and add reset_location field.


2018-06-27  Eric Botcazou  <ebotcazou@adacore.com>

        * gnat.dg/debug15.adb: New test.

-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 4456 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180627/d4dbd8bc/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug15.adb
Type: text/x-adasrc
Size: 361 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180627/d4dbd8bc/attachment-0001.bin>


More information about the Gcc-patches mailing list