https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110295
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:01f088741bec84f8fa86f87fdb73db07d5febb0a commit r11-11140-g01f088741bec84f8fa86f87fdb73db07d5febb0a Author: Richard Biener <rguent...@suse.de> Date: Mon Jun 19 09:23:16 2023 +0200 debug/110295 - mixed up early/late debug for member DIEs When we process a scope typedef during early debug creation and we have already created a DIE for the type when the decl is TYPE_DECL_IS_STUB and this DIE is still in limbo we end up just re-parenting that type DIE instead of properly creating a DIE for the decl, eventually picking up the now completed type and creating DIEs for the members. Instead this is currently defered to the second time we come here, when we annotate the DIEs with locations late where now the type DIE is no longer in limbo and we fall through doing the job for the decl. The following makes sure we perform the necessary early tasks for this by continuing with the decl DIE creation after setting a parent for the limbo type DIE. PR debug/110295 * dwarf2out.c (process_scope_var): Continue processing the decl after setting a parent in case the existing DIE was in limbo. * g++.dg/debug/pr110295.C: New testcase. (cherry picked from commit 963f87f8a65ec82f503ac4334a3da83b0a8a43b2)