Message ID | ormt79ea05.fsf@lxoliva.fsfla.org |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1223033wrt; Mon, 26 Dec 2022 20:39:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXvRuVSs9wUDyXHXaQ6xKOweszf+F9CT50vpkiiXF5+XZqpZh/m5WSlBdgKvyKOvz5RA+kD7 X-Received: by 2002:a17:906:850c:b0:7c0:f44d:984 with SMTP id i12-20020a170906850c00b007c0f44d0984mr24249867ejx.74.1672115981150; Mon, 26 Dec 2022 20:39:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672115981; cv=none; d=google.com; s=arc-20160816; b=PV01vwwTSmRr0jVJzfTgAuQnHfr5BYeHCZgzMlR7di/TZuUqDnLSAnjJ36mrQ5aE+n 87zYnMj6Z3869v+UKfvByWTiMfRWT/Xk3fljENoaLGCFBtj8aPwZ8f2TN7EmNU9n7lW+ fayM3+RUGgG7wTHWzWeV16asvjySkfCL1/YnORXgxQ3LMHKhroPiOKiU5XudbC/tPtNc DO9boNJzWdTkAWZAjEKcqW/Y3B41QoqrIAfovxErNrMDUoKdAKyDjiCxcGQ2F3akeOrv jDoPw8yGYvOYeGGLZ3shdIsAkwuMfUj7/OMVfjLMk9LRlC7QY2ZSqw9GlH6kuqizNfPu Bvew== 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=o20KEfavBdD7EgRqu/jaVa/R2gJHcJBkbuTDAJUqoYM=; b=q75SQYVMGERxRfeOxbdj/aLm4BtLRs6On2F4DuiJqSfqj0WswWWqGiG2h2LNShQYIf Wzpy8uIrjQqE5ZO9GMRxp9+14E32vSUYvR/dz5DIwfYHNwSEXyJCMdES7axi0NdvP4M+ IdRz4tSqmi7cxhTFosjdVfFSBziDAnovUim1njZwXBaB69C54zD6bq9+FW1HNLDyaxts qe9UYIwg11rdne7w4zjmJWRty/ZdFzdP71DOYEDYmSv6KOtwihP1KPS6qU09ZFZTTYWy tjofl+S56P/jLlGR8xDz74CMi57YXqKlxS/CT0tx9IqtzoJIapmxqyyo8aAS8Tmsypcl kuYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=O3tN+NrC; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id w16-20020a05640234d000b0046b953601besi11225854edc.29.2022.12.26.20.39.41 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Dec 2022 20:39:41 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=O3tN+NrC; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 3AD543858D3C for <ouuuleilei@gmail.com>; Tue, 27 Dec 2022 04:39:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3AD543858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672115980; 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=O3tN+NrCyq5BYnGeQJNJZKGASpzg0z6olK+ZDOE0IQaIu2T/qifnbjwfB3aSIl/lh UJryfOL95p8fzzI+MqPN5wZzJ7Fp65Nxz/HULFW+Hocn2Ls7+0DxuiTZhXpsBy2O21 HklFm1wdmxpiKxEp6hqG/SfskO2WzNyOvkLUkgkw= 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 <gcc-patches@gcc.gnu.org>; 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: <or5ydxh4l4.fsf@lxoliva.fsfla.org> Date: Tue, 27 Dec 2022 01:38:50 -0300 In-Reply-To: <or5ydxh4l4.fsf@lxoliva.fsfla.org> (Alexandre Oliva's message of "Tue, 27 Dec 2022 01:07:35 -0300") Message-ID: <ormt79ea05.fsf@lxoliva.fsfla.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Alexandre Oliva via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Alexandre Oliva <oliva@adacore.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753340687173820276?= X-GMAIL-MSGID: =?utf-8?q?1753340687173820276?= |
Series |
[01/13] scoped tables: insert before further lookups
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Alexandre Oliva
Dec. 27, 2022, 4:38 a.m. UTC
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(-)
Comments
On 12/26/22 21:38, Alexandre Oliva via Gcc-patches wrote: > > 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. OK once prereqs are installed. jeff
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; }