From patchwork Tue Dec 27 04:17:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1719569 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=ofbcxAUF; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nh1b90MlHz23dc for ; Tue, 27 Dec 2022 15:17:39 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 55A593858C27 for ; Tue, 27 Dec 2022 04:17:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 55A593858C27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672114657; bh=OfNllI4GrBohry2jwd8P10zjUvrD9Wb28lEW84qMX28=; 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=ofbcxAUFhKMtw/gPIPtr4UGmHiKoRxZDImzALU9rc77U+4uI8/wdilu/2zbsJgVUG t+CQK/1Ns1J/6L9D51JkDASjhhleQZlh5Rxn2P5Ww8yXOtFdTL0lU61mWg7+IwrOxo KmQGPmxA8bKRC9h7JdFhlmtzxHsVbDMI6SuTB8wU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTPS id C83F53858D38 for ; Tue, 27 Dec 2022 04:17:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C83F53858D38 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 90F4F1162A6; Mon, 26 Dec 2022 23:17:17 -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 pzSwmPrT6DlK; Mon, 26 Dec 2022 23:17:17 -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 3139D11628F; Mon, 26 Dec 2022 23:17:17 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 2BR4HARn711938 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 27 Dec 2022 01:17:10 -0300 To: gcc-patches@gcc.gnu.org Subject: [01/13] scoped tables: insert before further lookups Organization: Free thinker, does not speak for AdaCore References: Date: Tue, 27 Dec 2022 01:17:10 -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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Avoid hash table lookups between requesting an insert and storing the inserted value in avail_exprs_stack. Lookups before the insert is completed could fail to find double-hashed elements. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChangeLog * tree-ssa-scopedtables.cc (avail_exprs_stack::lookup_avail_expr): Finish hash table insertion before further lookups. --- gcc/tree-ssa-scopedtables.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/tree-ssa-scopedtables.cc b/gcc/tree-ssa-scopedtables.cc index 6d203ef89ecef..3e6e129e7d5d3 100644 --- a/gcc/tree-ssa-scopedtables.cc +++ b/gcc/tree-ssa-scopedtables.cc @@ -259,11 +259,6 @@ avail_exprs_stack::lookup_avail_expr (gimple *stmt, bool insert, bool tbaa_p, } else if (*slot == NULL) { - /* If we did not find the expression in the hash table, we may still - be able to produce a result for some expressions. */ - tree retval = avail_exprs_stack::simplify_binary_operation (stmt, - element); - /* We have, in effect, allocated *SLOT for ELEMENT at this point. We must initialize *SLOT to a real entry, even if we found a way to prove ELEMENT was a constant after not finding ELEMENT @@ -277,6 +272,11 @@ avail_exprs_stack::lookup_avail_expr (gimple *stmt, bool insert, bool tbaa_p, class expr_hash_elt *element2 = new expr_hash_elt (element); *slot = element2; + /* If we did not find the expression in the hash table, we may still + be able to produce a result for some expressions. */ + tree retval = avail_exprs_stack::simplify_binary_operation (stmt, + element); + record_expr (element2, NULL, '2'); return retval; } 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: 1719570 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=G4UGQgoU; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nh1cr6DD2z23dc for ; Tue, 27 Dec 2022 15:19:08 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C789A3858C2C for ; Tue, 27 Dec 2022 04:19:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C789A3858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672114746; 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=G4UGQgoU0aHUabBjAV0oE52CiESJlVZQl84aZE+WImdLMn/mBYz+bJdm4EfmN9jrp VAOMj69JTo3Qq6vJxf3n1TUXtuFKZQtjm0XRlOZOyTjMTfY+GtoPJ3TpYDa3b1VtmD U6VKq0ru3N73dBaP4WcjkIhxpUptap8Cisyv/MIY= 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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); } } From patchwork Tue Dec 27 04:19:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1719571 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=vTwdwGEU; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nh1f75fKgz23dZ for ; Tue, 27 Dec 2022 15:20:15 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6C3EA3858431 for ; Tue, 27 Dec 2022 04:20:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6C3EA3858431 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672114813; bh=/PgCft1l4EDdjOvRkxQTxgtYwaE0wX7X55ujfEfrbLU=; 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=vTwdwGEUf7hvWsC/PS/Z008zcAtEXQ4g2rGuUlAkr9LAiEfvph4vjlj3gsuAw+IvQ 5JtVPmEO/b3D6MKBiK8iXF/WMsR412GQcV0008zHqwx7wTal15QmDebXMDHezntP0U bczqn3nqFtiMF0PNFw6rBF9FZ5ao873RDMwwbTC8= 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 B47C13858422 for ; Tue, 27 Dec 2022 04:19:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B47C13858422 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 8A2121162A6; Mon, 26 Dec 2022 23:19:54 -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 EZjwON2FBhZ2; Mon, 26 Dec 2022 23:19:54 -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 2AE7711628F; Mon, 26 Dec 2022 23:19:54 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 2BR4Jl83712025 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 27 Dec 2022 01:19:47 -0300 To: gcc-patches@gcc.gnu.org Subject: [03/13] tree-inline decl_map: skip mapping NULL to itself Organization: Free thinker, does not speak for AdaCore References: Date: Tue, 27 Dec 2022 01:19:47 -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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Mapping a NULL key is no use, skip it. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChangeLog * tree-inline.cc (insert_decl_map): Skip mapping a NULL decl as value to itself. --- gcc/tree-inline.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc index c6c86af6c4ea9..bfea1cc11822e 100644 --- a/gcc/tree-inline.cc +++ b/gcc/tree-inline.cc @@ -148,7 +148,7 @@ insert_decl_map (copy_body_data *id, tree key, tree value) /* Always insert an identity map as well. If we see this same new node again, we won't want to duplicate it a second time. */ - if (key != value) + if (key != value && value) id->decl_map->put (value, value); } From patchwork Tue Dec 27 04:21:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1719572 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=Wu0Xvpd/; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nh1hY43DBz23dZ for ; Tue, 27 Dec 2022 15:22:21 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2A7A9385840F for ; Tue, 27 Dec 2022 04:22:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A7A9385840F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672114938; bh=Yqz7XHYk96kgrRslQ3Yex/UqpsmoYrYKDvsEqHaiLSs=; h=To:Cc:Subject:References:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Wu0Xvpd/LgLUG1Ue9ySSDZYgi1tmKTad+OpmPFmjR0ujBZLFONfjIvJfFgCLpwCDV 9lSyZFacstB6PXmHsEreZiAqbX4lsl7waMDHJ5LrgnqkEFQyJPpLiPNIOgfULNbkhm +ntmePxDmo80YI0ga060vf6Thb44KWnjZoATdjn0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTPS id E83CA3858D32 for ; Tue, 27 Dec 2022 04:21:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E83CA3858D32 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id BD1EE1162A6; Mon, 26 Dec 2022 23:21:58 -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 ZI-WUsrdkY8U; Mon, 26 Dec 2022 23:21:58 -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 5E83411628F; Mon, 26 Dec 2022 23:21:58 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 2BR4Lo0W712080 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 27 Dec 2022 01:21:50 -0300 To: gcc-patches@gcc.gnu.org Cc: Jason Merrill , Nathan Sidwell Subject: [04/13] [C++] constraint: insert norm entry once Organization: Free thinker, does not speak for AdaCore References: Date: Tue, 27 Dec 2022 01:21:50 -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.3 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Use NO_INSERT to test whether inserting should be attempted. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/cp/ChangeLog * constraint.cc (normalize_concept_check): Use NO_INSERT for pre-insertion check. --- gcc/cp/constraint.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index 37eae03afdb73..f28f96ada463e 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -777,14 +777,16 @@ normalize_concept_check (tree check, tree args, norm_info info) norm_entry entry = {tmpl, targs, NULL_TREE}; norm_entry **slot = nullptr; hashval_t hash = 0; + bool insert = false; if (!info.generate_diagnostics ()) { /* Cache the normal form of the substituted concept-id (when not diagnosing). */ hash = norm_hasher::hash (&entry); - slot = norm_cache->find_slot_with_hash (&entry, hash, INSERT); - if (*slot) + slot = norm_cache->find_slot_with_hash (&entry, hash, NO_INSERT); + if (slot) return (*slot)->norm; + insert = true; } /* The concept may have been ill-formed. */ @@ -794,7 +796,7 @@ normalize_concept_check (tree check, tree args, norm_info info) info.update_context (check, args); tree norm = normalize_expression (def, targs, info); - if (slot) + if (insert) { /* Recompute SLOT since norm_cache may have been expanded during the recursive call. */ From patchwork Tue Dec 27 04:22:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1719573 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=t0j1BAyg; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nh1jd6C9yz23dZ for ; Tue, 27 Dec 2022 15:23:16 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 417163858404 for ; Tue, 27 Dec 2022 04:23:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 417163858404 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672114994; bh=HjgLGbTwZlo/mdqI6jJwSYzhxqZ9P9dfpykfpRfmxro=; 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=t0j1BAyg18XNEAsEaii1AgvwlCHDuLuVROSbUJ4o8KcQ6I715ScttFOytB/3gXmom 9HqjciGW9h70AWKOHl/fpw7h4MpXTez0qi7JuUoiXGmisc+oXd6PhxmdgszMaWNmv6 4KaqdRKei9QX0T6OGf+LQJE/h9u8dwb68O0c+G78= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTPS id 1CACB3858416 for ; Tue, 27 Dec 2022 04:22:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1CACB3858416 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id D71A21162AC; Mon, 26 Dec 2022 23:22:36 -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 cLbmacll-P3P; Mon, 26 Dec 2022 23:22:36 -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 9EAB01162AB; Mon, 26 Dec 2022 23:22:36 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 2BR4MSad712153 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 27 Dec 2022 01:22:28 -0300 To: gcc-patches@gcc.gnu.org Subject: [05/13] ssa-loop-niter: skip caching of null operands Organization: Free thinker, does not speak for AdaCore References: Date: Tue, 27 Dec 2022 01:22:28 -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.3 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" When a TREE_OPERAND is NULL, do not cache it. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChangeLog * tree-ssa-loop-niter.cc (expand_simple_operands): Refrain from caching NULL TREE_OPERANDs. --- gcc/tree-ssa-loop-niter.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/tree-ssa-loop-niter.cc b/gcc/tree-ssa-loop-niter.cc index fece876099c16..17645648326e8 100644 --- a/gcc/tree-ssa-loop-niter.cc +++ b/gcc/tree-ssa-loop-niter.cc @@ -2325,6 +2325,8 @@ expand_simple_operations (tree expr, tree stop, hash_map &cache) for (i = 0; i < n; i++) { e = TREE_OPERAND (expr, i); + if (!e) + continue; /* SCEV analysis feeds us with a proper expression graph matching the SSA graph. Avoid turning it into a tree here, thus handle tree sharing From patchwork Tue Dec 27 04:23:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1719575 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=cGSK7n/6; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nh1q36NPJz23dD for ; Tue, 27 Dec 2022 15:27:59 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 516513858C27 for ; Tue, 27 Dec 2022 04:27:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 516513858C27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672115277; bh=ICanSbrAIBRMKeEwo2aMRWmhuZdx7zWOKpQJ6LQJkjg=; 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=cGSK7n/61e2eWLwBKdPFaj6XePOqTjxwsK6CxhocDEZJNP2birXEMrcNcT67ZALYR jTMD82NhvshrOm0UQ87UIxVWL32bLGlKIDW8WlUmK3Xjb54hQSxlpSVythBfUuDZuc bZhaseCcF89xAxjlJqR6lrgbCGpCmbbnS3+DFc5w= 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 BF0C33858D32 for ; Tue, 27 Dec 2022 04:27:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BF0C33858D32 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 854D31162AC; Mon, 26 Dec 2022 23:27:38 -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 9DaWA6Dd0eZ5; Mon, 26 Dec 2022 23:27:38 -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 4D0571162AB; Mon, 26 Dec 2022 23:27:38 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 2BR4NMXR712163 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 27 Dec 2022 01:23:22 -0300 To: gcc-patches@gcc.gnu.org Subject: [06/13] tree-inline decl_map: skip mapping result's NULL default def Organization: Free thinker, does not speak for AdaCore References: Date: Tue, 27 Dec 2022 01:23:22 -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.3 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" If a result doesn't have a default def, don't attempt to remap it. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChangeLog * tree-inline.cc (declare_return_variable): Don't remap NULL default def of result. --- gcc/tree-inline.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc index bfea1cc11822e..4556256dc32b1 100644 --- a/gcc/tree-inline.cc +++ b/gcc/tree-inline.cc @@ -3851,10 +3851,11 @@ declare_return_variable (copy_body_data *id, tree return_slot, tree modify_dest, it's default_def SSA_NAME. */ if (gimple_in_ssa_p (id->src_cfun) && is_gimple_reg (result)) - { - temp = make_ssa_name (temp); - insert_decl_map (id, ssa_default_def (id->src_cfun, result), temp); - } + if (tree default_def = ssa_default_def (id->src_cfun, result)) + { + temp = make_ssa_name (temp); + insert_decl_map (id, default_def, temp); + } insert_init_stmt (id, entry_bb, gimple_build_assign (temp, var)); } else From patchwork Tue Dec 27 04:24:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1719574 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=DKtJuMrb; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nh1lL4qxkz23dZ for ; Tue, 27 Dec 2022 15:24:46 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 729893858C1F for ; Tue, 27 Dec 2022 04:24:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 729893858C1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672115084; bh=rUtBeNzUuCxSRz2rrUo14KS99/91mJRJ/SsIDlDURqc=; 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=DKtJuMrb6/C5n1EgGLj3FKsxQJbe+Xujr2xcr4fZVI/P2f7YNFbdlv+S9PbhbFxY5 MSaSdurMadokcWCOwWM6VtpzkhEa4qL+sOdOLnePKhGPLy4Jb9wqrJxfdna2V36Pdm qLCuPNLHsKoNmf/h/nmWbOm29LU+q4n+N0Jg4irc= 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 1AC7C3858D32 for ; Tue, 27 Dec 2022 04:24:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1AC7C3858D32 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E3F361162AC; Mon, 26 Dec 2022 23:24:24 -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 4vPr7Z8F8lnN; Mon, 26 Dec 2022 23:24:24 -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 978801162AB; Mon, 26 Dec 2022 23:24:23 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 2BR4OFS9712192 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 27 Dec 2022 01:24:16 -0300 To: gcc-patches@gcc.gnu.org Subject: [07/13] postreload-gcse: no insert on mere lookup Organization: Free thinker, does not speak for AdaCore References: Date: Tue, 27 Dec 2022 01:24:15 -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.3 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" lookup_expr_in_table is not used for insertions, but it mistakenly used INSERT rather than NO_INSERT. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChangeLog * postreload-gcse.cc (lookup_expr_in_table): Use NO_INSERT. --- gcc/postreload-gcse.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/postreload-gcse.cc b/gcc/postreload-gcse.cc index 1c795b43ca36b..2818f54dedd29 100644 --- a/gcc/postreload-gcse.cc +++ b/gcc/postreload-gcse.cc @@ -447,7 +447,7 @@ lookup_expr_in_table (rtx pat) tmp_expr->hash = hash; tmp_expr->avail_occr = NULL; - slot = expr_table->find_slot_with_hash (tmp_expr, hash, INSERT); + slot = expr_table->find_slot_with_hash (tmp_expr, hash, NO_INSERT); obstack_free (&expr_obstack, tmp_expr); if (!slot) From patchwork Tue Dec 27 04:28:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1719576 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=H3cs5UVH; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nh1rY6QDQz23dD for ; Tue, 27 Dec 2022 15:29:14 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D1C603858C83 for ; Tue, 27 Dec 2022 04:29:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D1C603858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672115352; bh=hjoyAQbe1zLl3l1oJ07seSAUO6IgUyS/uxBV91i8J2A=; 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=H3cs5UVH3gCz2YxT2Q/maeUJI7Haz+/ZJbz4VXoWi7QkiZmPDb9KKcJIrZSDkD1qk OjnvIjGwC0BaJeL7qluf3u3JwhRyqLxzd784Y40O/bmMvTBm0geZ7Ym8Ib6D/wHAXz qDavyX35nNVhXVGkbKek/I0NcM2mCXnlFJKl6VAo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTPS id CC82C3858D32 for ; Tue, 27 Dec 2022 04:28:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CC82C3858D32 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 9D8631162AC; Mon, 26 Dec 2022 23:28:53 -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 V7C4PA5fthID; Mon, 26 Dec 2022 23:28:53 -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 3EC301162AB; Mon, 26 Dec 2022 23:28:53 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 2BR4SjDK712351 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 27 Dec 2022 01:28:45 -0300 To: gcc-patches@gcc.gnu.org Subject: [08/13] tm: complete tm_restart insertion Organization: Free thinker, does not speak for AdaCore References: Date: Tue, 27 Dec 2022 01:28:45 -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.3 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Insertion of a tm_restart_node in tm_restart failed to record the newly-allocated node in the hash table. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChangeLog * trans-mem.cc (split_bb_make_tm_edge): Record new node in tm_restart. --- gcc/trans-mem.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/trans-mem.cc b/gcc/trans-mem.cc index 131dce05476ac..cbd1b891266fd 100644 --- a/gcc/trans-mem.cc +++ b/gcc/trans-mem.cc @@ -3215,7 +3215,7 @@ split_bb_make_tm_edge (gimple *stmt, basic_block dest_bb, struct tm_restart_node *n = *slot; if (n == NULL) { - n = ggc_alloc (); + *slot = n = ggc_alloc (); *n = dummy; } else From patchwork Tue Dec 27 04:30:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1719577 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=EemxsgDa; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nh1t81xpTz23dc for ; Tue, 27 Dec 2022 15:30:40 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4634F3858409 for ; Tue, 27 Dec 2022 04:30:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4634F3858409 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672115438; bh=3TwQNnw9AuDlFblj0lK4GThcGK41glUKVXhzbrpRfkI=; h=To:Cc:Subject:References:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=EemxsgDa6uVnz0IAvatdxK3Liaf4QBkIIdq4uqA7LBPqHL+KQTkup37BKz8H90BbB 8IQXpnuXJzbisJr8WWBVjsuqEvr04S7NGU0eo25Os2UVe8PFLcGiw65NseA7snIuaG Rcpya4D/5UZ03s5eLtCMI8jb5h34igOgwrYFLBfE= 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 AA2693858D3C for ; Tue, 27 Dec 2022 04:30:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AA2693858D3C Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 7DC3D1162A6; Mon, 26 Dec 2022 23:30:09 -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 x8Tbz2gYLg1O; Mon, 26 Dec 2022 23:30:09 -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 1CFB811628F; Mon, 26 Dec 2022 23:30:08 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 2BR4U0lW712370 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 27 Dec 2022 01:30:00 -0300 To: gcc-patches@gcc.gnu.org Cc: Jason Merrill , Nathan Sidwell Subject: [09/13] [C++] constexpr: request insert iff depth is ok Organization: Free thinker, does not speak for AdaCore References: Date: Tue, 27 Dec 2022 01:30:00 -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.3 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" cxx_eval_call_expression requests an INSERT even in cases when it would later decide not to insert. This could break double-hashing chains. Arrange for it to use NO_INSERT when the insertion would not be completed. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/cp/ChangeLog * constexpr.cc (cxx_eval_call_expression): Do not request an INSERT that would not be completed. --- gcc/cp/constexpr.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc index d99c49bdbe282..6d20ffa2cdeb6 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -3000,13 +3000,15 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, /* If we have seen this call before, we are done. */ maybe_initialize_constexpr_call_table (); + bool insert = depth_ok < constexpr_cache_depth; constexpr_call **slot - = constexpr_call_table->find_slot (&new_call, INSERT); - entry = *slot; + = constexpr_call_table->find_slot (&new_call, + insert ? INSERT : NO_INSERT); + entry = slot ? *slot : NULL; if (entry == NULL) { /* Only cache up to constexpr_cache_depth to limit memory use. */ - if (depth_ok < constexpr_cache_depth) + if (insert) { /* We need to keep a pointer to the entry, not just the slot, as the slot can move during evaluation of the body. */ From patchwork Tue Dec 27 04:35:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1719578 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=QdsWRCoh; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nh20f4ysTz23dZ for ; Tue, 27 Dec 2022 15:36:14 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 26531385840F for ; Tue, 27 Dec 2022 04:36:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 26531385840F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672115772; bh=iAJcLChQMbxrg1h0EkXdm7nMJF9Nfav1QypwnGoURj0=; h=To:Cc:Subject:References:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=QdsWRCohe+U53oFa6+KLR89gSwRRaHgkhqsv6AjbKzqjZvt7QybKrf2wCssf1csBP s5xrwP063+u21Z6kolcW03zZ3okbn50iTIDpZF1wOrR4EfsJyDMt2jaEudFrL750DA ue77yzhsdFCGQozUd87yTenB0MQHqRIT1Z4t0O3g= 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 AC7D03858D32 for ; Tue, 27 Dec 2022 04:35:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AC7D03858D32 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 74C2B1162AB; Mon, 26 Dec 2022 23:35:53 -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 FFiPhLlJGumF; Mon, 26 Dec 2022 23:35:53 -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 2292F11628F; Mon, 26 Dec 2022 23:35:52 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 2BR4ZjLR712560 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 27 Dec 2022 01:35:45 -0300 To: gcc-patches@gcc.gnu.org Cc: Richard Biener Subject: [10/13] lto: drop dummy partition mapping Organization: Free thinker, does not speak for AdaCore References: Date: Tue, 27 Dec 2022 01:35:45 -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.3 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" When adding a catch-all partition, we map NULL to it. That mapping is ineffective and unnecessary. Drop it. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/lto/ChangeLog * lto-partition.cc (lto_1_to_1_map): Drop NULL partition mapping. --- gcc/lto/lto-partition.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/gcc/lto/lto-partition.cc b/gcc/lto/lto-partition.cc index ebb9c3abe128c..654d67f272e92 100644 --- a/gcc/lto/lto-partition.cc +++ b/gcc/lto/lto-partition.cc @@ -333,7 +333,6 @@ lto_1_to_1_map (void) else { partition = new_partition (""); - pmap.put (NULL, partition); npartitions++; } From patchwork Tue Dec 27 04:38:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1719579 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=R6VRtPOL; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nh23C4hMJz23dZ for ; Tue, 27 Dec 2022 15:38:31 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8CF8C3858C1F for ; Tue, 27 Dec 2022 04:38:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8CF8C3858C1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672115909; bh=IqDf9XnWor5jBjPURYaKN1705DwEV5dkarxbLVHfpl4=; h=To:Cc:Subject:References:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=R6VRtPOLOzbH/BSkHPtG303ph/NR8z8dnXopjrlCZ2uZ8pXkA1JU3NypmEYegkNnG 9nkl/6DLbn4GeoDeGAml1yVQl5ubb7FDLF+UEroM1E49TP5Pt5/u5ML2sJlUjjVNwb CNaR7A7gBqTTeMKGsVvd7VJ1gvfhmXTPqO1qPuMQ= 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 78C243858D32 for ; Tue, 27 Dec 2022 04:38:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 78C243858D32 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 4E2E71162A6; Mon, 26 Dec 2022 23:38:10 -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 RRpX8B4dncfr; Mon, 26 Dec 2022 23:38:10 -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 E609C11628F; Mon, 26 Dec 2022 23:38:09 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 2BR4c0pp712593 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 27 Dec 2022 01:38:00 -0300 To: gcc-patches@gcc.gnu.org Cc: Arnaud Charlet , Eric Botcazou , Marc =?utf-8?b?UG91bGhpw6hz?= , Pierre-Marie de Rodat Subject: [11/13] ada: don't map NULL decl to locus Organization: Free thinker, does not speak for AdaCore References: Date: Tue, 27 Dec 2022 01:38:00 -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.3 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" When decl is NULL, don't record its mapping in the decl_to_instance_map. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ada/ChangeLog * gcc-interface/trans.cc (Sloc_to_locus): Don't map NULL decl. --- gcc/ada/gcc-interface/trans.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index 59332f93614a9..6579ad11cc284 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -10564,7 +10564,7 @@ Sloc_to_locus (Source_Ptr Sloc, location_t *locus, bool clear_column, *locus = linemap_position_for_line_and_column (line_table, map, line, column); - if (file_map && file_map[file - 1].Instance) + if (decl && file_map && file_map[file - 1].Instance) decl_to_instance_map->put (decl, file_map[file - 1].Instance); return true; From patchwork Tue Dec 27 04:38:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1719580 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=c2CuUhJw; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nh2472lwGz23dZ for ; Tue, 27 Dec 2022 15:39:19 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BE30B385840D for ; Tue, 27 Dec 2022 04:39:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BE30B385840D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672115956; bh=o20KEfavBdD7EgRqu/jaVa/R2gJHcJBkbuTDAJUqoYM=; 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=c2CuUhJweege7Uw++6HfElNHivQ94dlIZmo2WSU+9Q7k1mhAVxucn/CkCUTTCLHeD +EIPSYe+/LPNgm2iRd/4/TPa5mQTfwS75q64nB1uxQQvz82jXkDTdaCTzykj2sUJu0 dSiUCTpEKBWvLU0QguaaeXd92vDP67Nq0HcwmY64= 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 DBB98385840D for ; Tue, 27 Dec 2022 04:38:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DBB98385840D Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id AEDC71162A6; Mon, 26 Dec 2022 23:38:58 -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 Nw9ZoLWITYvo; Mon, 26 Dec 2022 23:38:58 -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 73A1A11628F; Mon, 26 Dec 2022 23:38:58 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 2BR4coML712622 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 27 Dec 2022 01:38:50 -0300 To: gcc-patches@gcc.gnu.org Subject: [12/13] hash set: reject attempts to add empty values Organization: Free thinker, does not speak for AdaCore References: Date: Tue, 27 Dec 2022 01:38:50 -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.3 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Check, after adding a key to a hash set, that the entry does not look empty. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChangeLog * hash-set.h (add): Check that the inserted entry does not look empty. --- gcc/hash-set.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/hash-set.h b/gcc/hash-set.h index 76fa7f394561e..a98121a060eed 100644 --- a/gcc/hash-set.h +++ b/gcc/hash-set.h @@ -58,7 +58,11 @@ public: Key *e = m_table.find_slot_with_hash (k, Traits::hash (k), INSERT); bool existed = !Traits::is_empty (*e); if (!existed) - new (e) Key (k); + { + new (e) Key (k); + // Catch attempts to insert e.g. a NULL pointer. + gcc_checking_assert (!Traits::is_empty (*e)); + } return existed; } From patchwork Tue Dec 27 04:39:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1719581 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=cKDVfiV/; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nh24w3c1wz23dZ for ; Tue, 27 Dec 2022 15:40:00 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 83D723858C2D for ; Tue, 27 Dec 2022 04:39:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 83D723858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672115998; bh=QfuLFqacFOLfzmRv/gdCEZF7xCNP+kn61CNo/gKr2WE=; 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=cKDVfiV/0FIq/eRYbp3CQ6C7tI2B4+ZyaZtJ6GXWJCLhbDs/ajVFq/BNl4pRm8dtJ KEj/txGZdSCybj9uhg4+4Mism4Ey46J/wsRhNXxqnLPVcXdadvvFGT6A4RUcXSaSZP 6eAmMLQfgK8p5aWoaZ/RDeRmboCmu4l9HNnZhLsY= 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 0B6933858C27 for ; Tue, 27 Dec 2022 04:39:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0B6933858C27 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id D31D61162A6; Mon, 26 Dec 2022 23:39:39 -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 lzd7Cq5YcRbW; Mon, 26 Dec 2022 23:39:39 -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 9B38711628F; Mon, 26 Dec 2022 23:39:39 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 2BR4dUtv712633 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 27 Dec 2022 01:39:30 -0300 To: gcc-patches@gcc.gnu.org Subject: [13/13] hash-map: reject empty-looking insertions Organization: Free thinker, does not speak for AdaCore References: Date: Tue, 27 Dec 2022 01:39:30 -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.3 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Check, after inserting entries, that they don't look empty. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChangeLog * hash-map.h (put, get_or_insert): Check that entry does not look empty after insertion. --- gcc/hash-map.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/hash-map.h b/gcc/hash-map.h index 457967f4bf1ae..63fa21cf37c5b 100644 --- a/gcc/hash-map.h +++ b/gcc/hash-map.h @@ -169,11 +169,12 @@ public: { hash_entry *e = m_table.find_slot_with_hash (k, Traits::hash (k), INSERT); - bool ins = hash_entry::is_empty (*e); + bool ins = Traits::is_empty (*e); if (ins) { e->m_key = k; new ((void *) &e->m_value) Value (v); + gcc_checking_assert (!Traits::is_empty (*e)); } else e->m_value = v; @@ -203,6 +204,7 @@ public: { e->m_key = k; new ((void *)&e->m_value) Value (); + gcc_checking_assert (!Traits::is_empty (*e)); } if (existed != NULL) From patchwork Wed Dec 28 12:30:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1719806 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=NNC/wfmZ; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NhrVH5lpwz23dZ for ; Wed, 28 Dec 2022 23:31:18 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 15B4B3858C30 for ; Wed, 28 Dec 2022 12:31:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 15B4B3858C30 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672230676; bh=n5PwsATnwOwKcK9D/ZbQbe0pPPk3pau4khzaLYqHyVQ=; 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=NNC/wfmZn6Vzf9Q7mcQ0TUHSycWx0uNEccS2vX6gueyxIYNAOsVKwKDrBDlnvcPhy IvBu2prtNgmJhWPrBGFaxOGXLpzeDmseeYZitogs87UzAUOmpQUh0NHvYtG/nP+vRK PjunvAP7HCwgtWY5tbx2FOqw75mNM9sHIkPDkD/8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTPS id D59E73858D33 for ; Wed, 28 Dec 2022 12:30:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D59E73858D33 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id BAE0B116312; Wed, 28 Dec 2022 07:30:47 -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 V4i0L8UAU2Uy; Wed, 28 Dec 2022 07:30:47 -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 8899E116304; Wed, 28 Dec 2022 07:30:47 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 2BSCUdbC743553 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 28 Dec 2022 09:30:41 -0300 To: gcc-patches@gcc.gnu.org Subject: [14/17] parloops: don't request insert that won't be completed Organization: Free thinker, does not speak for AdaCore References: Date: Wed, 28 Dec 2022 09:30:39 -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.3 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" In take_address_of, we may refrain from completing a decl_address INSERT if gsi is NULL, so dnn't even ask for an INSERT in this case. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChangeLog * tree-parloops.cc (take_address_of): Skip INSERT if !gsi. --- gcc/tree-parloops.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/tree-parloops.cc b/gcc/tree-parloops.cc index e680d97dd0497..b829ba7b873b6 100644 --- a/gcc/tree-parloops.cc +++ b/gcc/tree-parloops.cc @@ -1221,8 +1221,11 @@ take_address_of (tree obj, tree type, edge entry, uid = DECL_UID (TREE_OPERAND (TREE_OPERAND (*var_p, 0), 0)); int_tree_map elt; elt.uid = uid; - int_tree_map *slot = decl_address->find_slot (elt, INSERT); - if (!slot->to) + int_tree_map *slot = decl_address->find_slot (elt, + gsi == NULL + ? NO_INSERT + : INSERT); + if (!slot || !slot->to) { if (gsi == NULL) return NULL; From patchwork Wed Dec 28 12:32:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1719811 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=fv10JJ/p; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NhrXp4HQgz23dZ for ; Wed, 28 Dec 2022 23:33:30 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D9CE03858C2C for ; Wed, 28 Dec 2022 12:33:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D9CE03858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672230807; bh=ManF7Tb7kpzpON2PUf0kBDZF9qXlXsJANibs3IpZkDg=; h=To:Cc:Subject:References:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=fv10JJ/pWXkizGLc3L3TYG3UrGdYrhw09YHYo5sLK0Gx13j9X76AQ3W8POphE7bDI uP1EmijxtzI6baGOA+wbnSbOFVLMhpRHVDGaDm+xMvpxObmOuZGALDXn/42etJb+iq Ts2J+i3pwPq2CPbu/sgD/a46NQPLkK8X/u44ISyY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTPS id 379033858D33 for ; Wed, 28 Dec 2022 12:33:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 379033858D33 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 07903116316; Wed, 28 Dec 2022 07:33:00 -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 KEJ2LGTJ+gFU; Wed, 28 Dec 2022 07:32:59 -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 C8688116312; Wed, 28 Dec 2022 07:32:59 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 2BSCWq86743588 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 28 Dec 2022 09:32:53 -0300 To: David Malcolm Cc: gcc-patches@gcc.gnu.org Subject: [15/17] prevent hash set/map insertion of deleted entries Organization: Free thinker, does not speak for AdaCore References: <613b4501636146942775f23cfa8035f9eb7b84d3.camel@redhat.com> Date: Wed, 28 Dec 2022 09:32:52 -0300 In-Reply-To: <613b4501636146942775f23cfa8035f9eb7b84d3.camel@redhat.com> (David Malcolm's message of "Tue, 27 Dec 2022 12:53:18 -0500") 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.3 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" On Dec 27, 2022, David Malcolm wrote: > Would it make sense to also add assertions that such entries aren't > Traits::is_deleted? (both for hash_map and hash_set) Yeah, I guess so. I've come up with something for hash-table proper too, coming up in 17/17. Just like the recently-added checks for empty entries, add checks for deleted entries as well. This didn't catch any problems, but it might prevent future accidents. Suggested by David Malcolm. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChangeLog * hash-map.h (put, get_or_insert): Check that added entry doesn't look deleted either. & hash-set.h (add): Likewise. --- gcc/hash-map.h | 8 +++++--- gcc/hash-set.h | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/gcc/hash-map.h b/gcc/hash-map.h index 63fa21cf37c5b..e6ca9cf5e6429 100644 --- a/gcc/hash-map.h +++ b/gcc/hash-map.h @@ -173,8 +173,9 @@ public: if (ins) { e->m_key = k; - new ((void *) &e->m_value) Value (v); - gcc_checking_assert (!Traits::is_empty (*e)); + new ((void *)&e->m_value) Value (v); + gcc_checking_assert (!Traits::is_empty (*e) + && !Traits::is_deleted (*e)); } else e->m_value = v; @@ -204,7 +205,8 @@ public: { e->m_key = k; new ((void *)&e->m_value) Value (); - gcc_checking_assert (!Traits::is_empty (*e)); + gcc_checking_assert (!Traits::is_empty (*e) + && !Traits::is_deleted (*e)); } if (existed != NULL) diff --git a/gcc/hash-set.h b/gcc/hash-set.h index a98121a060eed..08e1851d5118d 100644 --- a/gcc/hash-set.h +++ b/gcc/hash-set.h @@ -61,7 +61,8 @@ public: { new (e) Key (k); // Catch attempts to insert e.g. a NULL pointer. - gcc_checking_assert (!Traits::is_empty (*e)); + gcc_checking_assert (!Traits::is_empty (*e) + && !Traits::is_deleted (*e)); } return existed; From patchwork Wed Dec 28 12:46:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1719822 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=qYjnKxec; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NhrrH6VHyz23dZ for ; Wed, 28 Dec 2022 23:46:54 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 565D63858C66 for ; Wed, 28 Dec 2022 12:46:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 565D63858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672231612; bh=SznVbtpk0UZCxzIlwNSbUWfWRmg8LH5ID5puFhQOCYs=; h=To:Cc:Subject:References:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=qYjnKxec+mvrr0fVc6deAMJ0eoZ4DVwEpa82CkK7x+B530p7ylr39GmkdzLhpItfN GBlLFmhN6RJ4eNVUHY2nQThJEkUZdEbUJlVXlEGgltadACb6j6c/28cnj4FdeQhWdR xoUOXHef/Jtn4KVbHzLuzFLHAif3WeEvRlJdJ4C8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTPS id 5AB113858D33 for ; Wed, 28 Dec 2022 12:46:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5AB113858D33 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 21287116304; Wed, 28 Dec 2022 07:46:33 -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 jqewHsGVlnxu; Wed, 28 Dec 2022 07:46:33 -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 DD2D5116213; Wed, 28 Dec 2022 07:46:32 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 2BSCkLkR743977 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 28 Dec 2022 09:46:22 -0300 To: Martin =?utf-8?b?TGnFoWth?= Cc: gcc-patches@gcc.gnu.org Subject: [16/17] check hash table counts at expand Organization: Free thinker, does not speak for AdaCore References: Date: Wed, 28 Dec 2022 09:46:20 -0300 In-Reply-To: ("Martin \=\?utf-8\?Q\?Li\=C5\=A1ka\=22's\?\= message of "Wed, 28 Dec 2022 09:50:11 +0100") 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.3 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" On Dec 28, 2022, Martin Liška wrote: > I really like the verification code you added. It's quite similar to what > I added to hash-table.h: *nod* Prompted by your encouragement, I've combined the element count verification code with the verify() loop, and also added it to expand, where it can be done cheaply. Add cheap verification of element and deleted entry counts during expand and hash verify. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChangeLog * hash-table.h (expand): Check elements and deleted counts. (verify): Likewise. --- gcc/hash-table.h | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/gcc/hash-table.h b/gcc/hash-table.h index 53507daae26c3..f4bda6102323e 100644 --- a/gcc/hash-table.h +++ b/gcc/hash-table.h @@ -805,19 +805,28 @@ hash_table::expand () hash_table_usage ().release_instance_overhead (this, sizeof (value_type) * osize); + size_t n_deleted = m_n_deleted; + m_entries = nentries; m_size = nsize; m_size_prime_index = nindex; m_n_elements -= m_n_deleted; m_n_deleted = 0; + size_t n_elements = m_n_elements; + value_type *p = oentries; do { value_type &x = *p; - if (!is_empty (x) && !is_deleted (x)) + if (is_empty (x)) + ; + else if (is_deleted (x)) + n_deleted--; + else { + n_elements--; value_type *q = find_empty_slot_for_expand (Descriptor::hash (x)); new ((void*) q) value_type (std::move (x)); /* After the resources of 'x' have been moved to a new object at 'q', @@ -829,6 +838,8 @@ hash_table::expand () } while (p < olimit); + gcc_checking_assert (!n_elements && !n_deleted); + if (!m_ggc) Allocator ::data_free (oentries); else @@ -1018,8 +1029,9 @@ hash_table return &m_entries[index]; } -/* Verify that all existing elements in th hash table which are - equal to COMPARABLE have an equal HASH value provided as argument. */ +/* Verify that all existing elements in the hash table which are + equal to COMPARABLE have an equal HASH value provided as argument. + Also check that the hash table element counts are correct. */ template class Allocator> @@ -1027,14 +1039,23 @@ void hash_table ::verify (const compare_type &comparable, hashval_t hash) { + size_t n_elements = m_n_elements; + size_t n_deleted = m_n_deleted; for (size_t i = 0; i < MIN (hash_table_sanitize_eq_limit, m_size); i++) { value_type *entry = &m_entries[i]; - if (!is_empty (*entry) && !is_deleted (*entry) - && hash != Descriptor::hash (*entry) - && Descriptor::equal (*entry, comparable)) - hashtab_chk_error (); + if (!is_empty (*entry)) + { + n_elements--; + if (is_deleted (*entry)) + n_deleted--; + else if (hash != Descriptor::hash (*entry) + && Descriptor::equal (*entry, comparable)) + hashtab_chk_error (); + } } + if (hash_table_sanitize_eq_limit >= m_size) + gcc_checking_assert (!n_elements && !n_deleted); } /* This function deletes an element with the given COMPARABLE value From patchwork Wed Dec 28 12:50:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1719825 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=FOfXlufV; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nhrwv5L2xz23dc for ; Wed, 28 Dec 2022 23:50:55 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A3B3A3858CDA for ; Wed, 28 Dec 2022 12:50:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A3B3A3858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672231853; bh=9AAKtjJuS6Nf76eh9BXvmE1MkZZ7t4J7QdWZmiYymXE=; 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=FOfXlufVkt0MXC56jUCz4erKUUbJdZNLaLyRrhcxEY0bN1ccDDxJlcToaFNq/kWaD c7wmgBBBU+PwXCxpbg3MDAQuElHskibW3/KwEKaCj4pC2j0xAg+sIOTcxRqoR7m6RA BiscdQifOiopB/bHcDYee5zJoRdC4tr1abycBO0M= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTPS id 859EE3858D33 for ; Wed, 28 Dec 2022 12:50:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 859EE3858D33 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 598BF116316; Wed, 28 Dec 2022 07:50:34 -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 z2OgpBsHNfKc; Wed, 28 Dec 2022 07:50:34 -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 061F4116312; Wed, 28 Dec 2022 07:50:33 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 2BSCoQ02744060 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 28 Dec 2022 09:50:26 -0300 To: gcc-patches@gcc.gnu.org Subject: [17/17] check hash table insertions Organization: Free thinker, does not speak for AdaCore References: Date: Wed, 28 Dec 2022 09:50:26 -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.3 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" On Dec 27, 2022, Alexandre Oliva wrote: > The number of bugs it revealed tells me that leaving callers in charge > of completing insertions is too error prone. I found this > verification code a bit too expensive to enable in general. Here's a relatively cheap, checking-only test to catch dangling inserts. I've noticed a number of potential problems in hash tables, of three kinds: insertion of entries that seem empty, dangling insertions, and lookups during insertions. These problems may all have the effect of replacing a deleted entry with one that seems empty, which may disconnect double-hashing chains involving that entry, and thus cause entries to go missing. This patch detects such problems by recording a pending insertion and checking that it's completed before other potentially-conflicting operations. The additional field is only introduced when checking is enabled. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChnageLog * hash-table.h (check_complete_insertion, check_insert_slot): New hash_table methods. (m_inserting_slot): New hash_table field. (begin, hash_table ctors, ~hash_table): Check previous insert. (expand, empty_slow, clear_slot, find_with_hash): Likewise. (remote_elt_with_hash, traverse_noresize): Likewise. (gt_pch_nx): Likewise. (find_slot_with_hash): Likewise. Record requested insert. --- gcc/hash-table.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 3 deletions(-) diff --git a/gcc/hash-table.h b/gcc/hash-table.h index f4bda6102323e..33753d04b7bdb 100644 --- a/gcc/hash-table.h +++ b/gcc/hash-table.h @@ -495,6 +495,7 @@ public: { if (Lazy && m_entries == NULL) return iterator (); + check_complete_insertion (); iterator iter (m_entries, m_entries + m_size); iter.slide (); return iter; @@ -551,8 +552,39 @@ private: Descriptor::mark_empty (v); } +public: + void check_complete_insertion () const + { +#if CHECKING_P + if (!m_inserting_slot) + return; + + gcc_checking_assert (m_inserting_slot >= &m_entries[0] + && m_inserting_slot < &m_entries[m_size]); + + if (!is_empty (*m_inserting_slot)) + m_inserting_slot = NULL; + else + gcc_unreachable (); +#endif + } + +private: + value_type *check_insert_slot (value_type *ret) + { +#if CHECKING_P + gcc_checking_assert (is_empty (*ret)); + m_inserting_slot = ret; +#endif + return ret; + } + +#if CHECKING_P + mutable value_type *m_inserting_slot; +#endif + /* Table itself. */ - typename Descriptor::value_type *m_entries; + value_type *m_entries; size_t m_size; @@ -607,6 +639,9 @@ hash_table::hash_table (size_t size, bool ggc, ATTRIBUTE_UNUSED, mem_alloc_origin origin MEM_STAT_DECL) : +#if CHECKING_P + m_inserting_slot (0), +#endif m_n_elements (0), m_n_deleted (0), m_searches (0), m_collisions (0), m_ggc (ggc), m_sanitize_eq_and_hash (sanitize_eq_and_hash) #if GATHER_STATISTICS @@ -639,6 +674,9 @@ hash_table::hash_table (const hash_table &h, ATTRIBUTE_UNUSED, mem_alloc_origin origin MEM_STAT_DECL) : +#if CHECKING_P + m_inserting_slot (0), +#endif m_n_elements (h.m_n_elements), m_n_deleted (h.m_n_deleted), m_searches (0), m_collisions (0), m_ggc (ggc), m_sanitize_eq_and_hash (sanitize_eq_and_hash) @@ -646,6 +684,8 @@ hash_table::hash_table (const hash_table &h, , m_gather_mem_stats (gather_mem_stats) #endif { + h.check_complete_insertion (); + size_t size = h.m_size; if (m_gather_mem_stats) @@ -675,6 +715,8 @@ template class Allocator> hash_table::~hash_table () { + check_complete_insertion (); + if (!Lazy || m_entries) { for (size_t i = m_size - 1; i < m_size; i--) @@ -778,6 +820,8 @@ template::expand () { + check_complete_insertion (); + value_type *oentries = m_entries; unsigned int oindex = m_size_prime_index; size_t osize = size (); @@ -853,6 +897,8 @@ template::empty_slow () { + check_complete_insertion (); + size_t size = m_size; size_t nsize = size; value_type *entries = m_entries; @@ -901,6 +947,8 @@ template::clear_slot (value_type *slot) { + check_complete_insertion (); + gcc_checking_assert (!(slot < m_entries || slot >= m_entries + size () || is_empty (*slot) || is_deleted (*slot))); @@ -927,6 +975,8 @@ hash_table if (Lazy && m_entries == NULL) m_entries = alloc_entries (size); + check_complete_insertion (); + #if CHECKING_P if (m_sanitize_eq_and_hash) verify (comparable, hash); @@ -976,6 +1026,8 @@ hash_table } if (insert == INSERT && m_size * 3 <= m_n_elements * 4) expand (); + else + check_complete_insertion (); #if CHECKING_P if (m_sanitize_eq_and_hash) @@ -1022,11 +1074,11 @@ hash_table { m_n_deleted--; mark_empty (*first_deleted_slot); - return first_deleted_slot; + return check_insert_slot (first_deleted_slot); } m_n_elements++; - return &m_entries[index]; + return check_insert_slot (&m_entries[index]); } /* Verify that all existing elements in the hash table which are @@ -1068,6 +1120,8 @@ void hash_table ::remove_elt_with_hash (const compare_type &comparable, hashval_t hash) { + check_complete_insertion (); + value_type *slot = find_slot_with_hash (comparable, hash, NO_INSERT); if (slot == NULL) return; @@ -1094,6 +1148,8 @@ hash_table::traverse_noresize (Argument argument) if (Lazy && m_entries == NULL) return; + check_complete_insertion (); + value_type *slot = m_entries; value_type *limit = slot + size (); @@ -1210,6 +1266,7 @@ template static void gt_pch_nx (hash_table *h) { + h->check_complete_insertion (); bool success = gt_pch_note_object (h->m_entries, h, hashtab_entry_note_pointers); gcc_checking_assert (success);