From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id A7A503853823; Fri, 14 Oct 2022 10:47:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A7A503853823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665744469; bh=DE26QkUEyNp/goxtVIQweCrN3fMAthI47nVrudwvAOg=; h=From:To:Subject:Date:From; b=xfV3VJ57duBg+LEtrdDJ4PU88hFRCBDbaGnfWrKkks4rTBi1jSbDgS9q813ie4nLE DvLY3p0s4PAD4rv8v53H7LNP5Yy9Q0ajcUfZ5YABkEgu2uWIrn4G8nTunaPB9jKWR7 MBmp8s/DsEry1eWJaI6F4yXDZdKs72Qr+fa7dZPw= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-11039] lto/106540 - fix LTO tree input wrt dwarf2out_register_external_die X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/releases/gcc-10 X-Git-Oldrev: 29ad829c93d530e75dee88d2550350c14fcaf8f6 X-Git-Newrev: d2fa5521282cc7b5510e1e2c431a56d12693d74f Message-Id: <20221014104749.A7A503853823@sourceware.org> Date: Fri, 14 Oct 2022 10:47:49 +0000 (GMT) List-Id: https://gcc.gnu.org/g:d2fa5521282cc7b5510e1e2c431a56d12693d74f commit r10-11039-gd2fa5521282cc7b5510e1e2c431a56d12693d74f Author: Richard Biener 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.c (lto_read_tree_1): Use lto_input_tree_1 to input DECL_INITIAL, avoiding to commit drefs. (cherry picked from commit 4769ac6c5dfde2810a0266fe388211edc644e623) Diff: --- gcc/lto-streamer-in.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index d5f581439fb..b0f8407a1d7 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -1689,11 +1689,14 @@ lto_read_tree_1 (class lto_input_block *ib, class data_in *data_in, tree expr) /* Read all the pointer fields in EXPR. */ streamer_read_tree_body (ib, data_in, expr); - /* Read any LTO-specific data not read by the tree streamer. */ + /* Read any LTO-specific data not read by the tree streamer. Do not use + stream_read_tree here since that flushes the dref_queue in mids of + SCC reading. */ if (DECL_P (expr) && TREE_CODE (expr) != FUNCTION_DECL && TREE_CODE (expr) != TRANSLATION_UNIT_DECL) - DECL_INITIAL (expr) = stream_read_tree (ib, data_in); + DECL_INITIAL (expr) + = lto_input_tree_1 (ib, data_in, streamer_read_record_start (ib), 0); /* Stream references to early generated DIEs. Keep in sync with the trees handled in dwarf2out_register_external_die. */