[Bug debug/126355] IPA ICF wrapper lacks an address-bearing DW_TAG_subprogram DIE
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Aug 14 06:11:45 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126355
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:b6477e6c4efd6df2719190cb048cf300ff31af46
commit r17-3278-gb6477e6c4efd6df2719190cb048cf300ff31af46
Author: Longjun Luo <luolongjuna@gmail.com>
Date: Thu Jul 23 00:01:50 2026 +0800
debug/126355 - preserve debug info for IPA ICF wrappers
When IPA ICF keeps a distinct symbol for an address-taken function by
replacing its body with a wrapper, cgraph_node::create_wrapper reuses the
original function declaration and its early debug DIE.
create_wrapper then calls expand_thunk with force_gimple_thunk set. Forced
GIMPLE thunks are normally created after early debug, so expand_thunk marks
their declarations ignored. For an ICF wrapper this also prevents final
debug emission from attaching the wrapper address to the existing DIE.
The wrapper consequently has code and an STT_FUNC symbol but no
address-bearing DW_TAG_subprogram DIE.
Preserve the declaration's original DECL_IGNORED_P value across forced
GIMPLE thunk expansion in create_wrapper. Declarations that were already
ignored remain ignored, while an original source declaration can receive
its final address information.
Tested on x86_64-pc-linux-gnu with the new gcc.dg/debug/dwarf2 test. The
test fails before the change and passes afterwards.
PR debug/126355
gcc/ChangeLog:
* cgraphunit.cc (cgraph_node::create_wrapper): Preserve
DECL_IGNORED_P across forced GIMPLE thunk expansion.
gcc/testsuite/ChangeLog:
* gcc.dg/debug/dwarf2/pr126355.c: New test.
Signed-off-by: Longjun Luo <luolongjuna@gmail.com>
More information about the Gcc-bugs
mailing list