https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107058
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:e2f3057fc911f9f55986b3de237b0155c0e09fe8 commit r14-8351-ge2f3057fc911f9f55986b3de237b0155c0e09fe8 Author: Richard Biener <rguent...@suse.de> Date: Tue Jan 23 09:51:00 2024 +0100 debug/107058 - gracefully handle unexpected DIE contexts While the bug is persisting that LTO streaming picks up a CONST_DECL from an attribute argument on a VAR_DECL which with -fdebug-type-section refers to a DIE in a type unit we can handle this gracefully, at least with -fno-checking. Do so. The C++ frontend nevetheless should resolve the CONST_DECL attribute argument to a constant. PR debug/107058 * dwarf2out.cc (dwarf2out_die_ref_for_decl): Gracefully handle unexpected but bogus DIE contexts when not checking enabled. * c-c++-common/pr107058.c: New testcase.