From patchwork Tue Dec 27 04:18:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 36764 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1218724wrt; Mon, 26 Dec 2022 20:19:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXvfD5IFUj2tLWv40YDlAkbXvSkmrlzjAS1LQIOvMndoRqjvwtcf8w2k6sx7e/uMVx/Yw9Ns X-Received: by 2002:a50:d616:0:b0:47c:6ed2:43d1 with SMTP id x22-20020a50d616000000b0047c6ed243d1mr18000195edi.30.1672114771452; Mon, 26 Dec 2022 20:19:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672114771; cv=none; d=google.com; s=arc-20160816; b=V7Cx3qgFIZIX1xaWutj1QKVl2D2u9uPWkpU1Q28E0P/hhXhk1HwSRHlgsB0AQSEKPW XV16VpaAxclyUQCBi8IvUi6v7SAZcSvrrxljcD0Mj653e1A3bFlzwB+Gc96Tzv34MIAd YFtaOh41Nl+/vu8jWNIzK2uS3JaMAMuW5TXADVgTEXZpNWQzJ0wBqBLIBnYj+oH1aafS I4l+GzBVHRz1BfbE1u5BHATyf1d2lwb0IeWfwMoCQc7WdY/FpOz1znzJ3alfMx6bDAcS DUOjlT9zHHdd1Ux366JFJy8iim0HnwcmWK/5lAfj3poNC3oxtLiikUJSK+NcRnyeSCGE B0RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:mime-version :user-agent:message-id:in-reply-to:date:references:organization :subject:to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=xV/uII29uJfJXwyu7cgG7Q4wBxJopBsMwWqh3W2YNOo=; b=HsZoLmGoOpizelOIT5oMxfFOh9sSUk97xeLXEV+Wzd7YU6kKutAorHfilAjCG3hkd1 g044a7D6Wx/n91ZOS8KVh59/6YWdOXSoAN6YpfXve1351bqYEcJgUL+NODBX1wNfqr77 9pjSBjoO8xwlg0bYczsQOwqEvvhGUPn2RxTqwrSDKnF1aba52xi37F0i1PyfVrcRXuT4 TQm7+r2CFBbhTxPs8CQb/hrUXNlZDXy9cCErxEksGZyPBy+SubQ+dISkXxzZqokhNN1p a/eZHdnv+HGF+CfoUV7uSx9F3b/Ukxmg7n1aRISt4IsG1hRhEyap8sjABQU+FFGNMd2d sKzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=WlWEa9OK; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id n11-20020aa7c44b000000b00467238595easi9444663edr.369.2022.12.26.20.19.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Dec 2022 20:19:31 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=WlWEa9OK; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3AC493858421 for ; Tue, 27 Dec 2022 04:19:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3AC493858421 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672114770; bh=xV/uII29uJfJXwyu7cgG7Q4wBxJopBsMwWqh3W2YNOo=; h=To:Subject:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=WlWEa9OKXeF1tqQ1MzLtC1GSb8sm/TmgyATMkHRzUK8FXsRn6h9Zv7XBJ3wxG5zUn uZgDQD7LaeG2gyCkLIz3uQFbouITUD94sis6jNzPK0JzL0THy+FHaAQSgRkQp9eAUS M7jE+hoAuqUAQYjuQtQOqC6fFaS8XzSNxEIFgiJ0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from rock.gnat.com (rock.gnat.com [205.232.38.15]) by sourceware.org (Postfix) with ESMTPS id 8B4EF3858D32 for ; Tue, 27 Dec 2022 04:18:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8B4EF3858D32 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 611981162A6; Mon, 26 Dec 2022 23:18:48 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id O+e0kaffoMUW; Mon, 26 Dec 2022 23:18:48 -0500 (EST) Received: from free.home (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id 01B4511628F; Mon, 26 Dec 2022 23:18:47 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 2BR4IbF6712009 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 27 Dec 2022 01:18:38 -0300 To: gcc-patches@gcc.gnu.org Subject: [02/13] varpool: do not add NULL vnodes to referenced Organization: Free thinker, does not speak for AdaCore References: Date: Tue, 27 Dec 2022 01:18:37 -0300 In-Reply-To: (Alexandre Oliva's message of "Tue, 27 Dec 2022 01:07:35 -0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alexandre Oliva via Gcc-patches From: Alexandre Oliva Reply-To: Alexandre Oliva Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753339418285918929?= X-GMAIL-MSGID: =?utf-8?q?1753339418285918929?= Avoid adding NULL vnodes to referenced tables. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChangeLog * varpool.c (symbol_table::remove_unreferenced_decls): Do not add NULL vnodes to referenced table. --- gcc/varpool.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/varpool.cc b/gcc/varpool.cc index bfd17f1250cc0..ccbd6e50f4b01 100644 --- a/gcc/varpool.cc +++ b/gcc/varpool.cc @@ -680,10 +680,12 @@ symbol_table::remove_unreferenced_decls (void) enqueue_node (vnode, &first); else { - referenced.add (vnode); + if (vnode) + referenced.add (vnode); while (vnode && vnode->alias && vnode->definition) { vnode = vnode->get_alias_target (); + gcc_checking_assert (vnode); referenced.add (vnode); } }