https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106540
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:4769ac6c5dfde2810a0266fe388211edc644e623 commit r12-8676-g4769ac6c5dfde2810a0266fe388211edc644e623 Author: Richard Biener <rguent...@suse.de> Date: Mon Aug 8 09:07:23 2022 +0200 lto/106540 - fix LTO tree input wrt dwarf2out_register_external_die I've revisited the earlier two workarounds for dwarf2out_register_external_die getting duplicate entries. It turns out that r11-525-g03d90a20a1afcb added dref_queue pruning to lto_input_tree but decl reading uses that to stream in DECL_INITIAL even when in the middle of SCC streaming. When that SCC then gets thrown away we can end up with debug nodes registered which isn't supposed to happen. The following adjusts the DECL_INITIAL streaming to go the in-SCC way, using lto_input_tree_1, since no SCCs are expected at this point, just refs. PR lto/106540 PR lto/106334 * lto-streamer-in.cc (lto_read_tree_1): Use lto_input_tree_1 to input DECL_INITIAL, avoiding to commit drefs. (cherry picked from commit 2a1448f2763a72c83e2ec496f78243a975b0d44e)