Message ID | 20221012065050.412900-3-aldyh@redhat.com |
---|---|
State | New, archived |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp2466725wrs; Tue, 11 Oct 2022 23:52:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4noWAa6TIahjxl6LLsaVnYtn3FbpMqss+MTcZzvGwyy8WBup80oHPCXaa/PprjmuggS7Hz X-Received: by 2002:a17:907:270f:b0:78d:728b:ff4 with SMTP id w15-20020a170907270f00b0078d728b0ff4mr19763527ejk.501.1665557554040; Tue, 11 Oct 2022 23:52:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665557554; cv=none; d=google.com; s=arc-20160816; b=vC3BiuTWGjmCqUTkh2aizQQidzfIyzto4qpn6t9AtWUT0YjicYxViVU5i7H3jivJBi nAf8/53/LEDt20pULcaUb/kpKReACD3nxV2TOhpSS3+syRLI13Y43hhoOuOOj/pXKEhX 6Ia6gzkdQjMD96xdB1KieujB8Z9T1+YHsh+zXHyYYhLcSLqMLbSyn7ldvdTEuRiD6ICz I8dL0AdyOVTuztbi8eWtYMjzLI3/wA56qsVFCGg8+AtFlmGU3vWE4IqfUpZmcbDrdgWZ WDFxXZ/Vae2zR70nODm0IgAthf+D6pc6/DM9jkeIxAzNS1ROenSsJzJSefwhfsCwbBQ0 NCkQ== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=j5q4Xau6O6CMqm1WqltjGxdNWkAKOS1jlxQtD3MkTpk=; b=YrBLvPLGeOvO+tXkQtScbQhoQ0wmUde0A6vpHue3/RH1lSYMH+AV+t5HeM00ZIOFzZ Pap01IvgaeUz9AEo7YEktV89oQhCE8WR85JK32VD9N+ajbKoIWoueLc08d1RQn51Mflw OeC3+aAB2e8Bh/OB4ln+dxvU4EDLXG1MdjRnwocjSSg0IoODCI4qhPexT7GkV8ps1B+u w6UEO9s8ymaMul2sAkEK459Qm0rAIowk5AfZIy+15JkCF8a5W3CsR7zm/HWivbhqjRsh krseewFo6PpJ1dAabveZNkoh2x9pprtw4sqI6TnkrtiGAZKG1Oauckg4RjUV7NxPGKAs EUlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=bT77Kv1y; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id o17-20020a509b11000000b0044ab43cbef1si14450967edi.450.2022.10.11.23.52.33 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 23:52:34 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=bT77Kv1y; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 84D00383FB80 for <ouuuleilei@gmail.com>; Wed, 12 Oct 2022 06:51:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 84D00383FB80 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665557504; bh=j5q4Xau6O6CMqm1WqltjGxdNWkAKOS1jlxQtD3MkTpk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=bT77Kv1yc5UcYfQWq4EJpJ7+iuEDQr3NZ6f3GDYDMRqbphd+kxLz+zK3mehVDl/89 bMtkrqa7tyS4Y6vpxOJoWu5eYR9BKRnAqpiA1ZMFBM+izTFfKbU7oo4tlGuJQk4vjj c5LaxSIf6P+Ya+LmdwbaZo4zmY21ho/44FmYWV8M= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 863CE385277E for <gcc-patches@gcc.gnu.org>; Wed, 12 Oct 2022 06:51:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 863CE385277E Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-275-SPepYcByPpW8QgeLDj9gAw-1; Wed, 12 Oct 2022 02:50:59 -0400 X-MC-Unique: SPepYcByPpW8QgeLDj9gAw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 861038027EB for <gcc-patches@gcc.gnu.org>; Wed, 12 Oct 2022 06:50:59 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.193.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2677FC23F71; Wed, 12 Oct 2022 06:50:55 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.17.1/8.17.1) with ESMTPS id 29C6osTP412950 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 12 Oct 2022 08:50:54 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 29C6ormh412949; Wed, 12 Oct 2022 08:50:53 +0200 To: GCC patches <gcc-patches@gcc.gnu.org> Subject: [COMMITTED] Disable tree to bool conversion in frange::update_nan. Date: Wed, 12 Oct 2022 08:50:48 +0200 Message-Id: <20221012065050.412900-3-aldyh@redhat.com> In-Reply-To: <20221012065050.412900-1-aldyh@redhat.com> References: <20221012065050.412900-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, 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: Aldy Hernandez via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Aldy Hernandez <aldyh@redhat.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?1746463677462714708?= X-GMAIL-MSGID: =?utf-8?q?1746463677462714708?= |
Series |
[COMMITTED] Disable tree to bool conversion in frange::update_nan.
|
|
Commit Message
Aldy Hernandez
Oct. 12, 2022, 6:50 a.m. UTC
We have a set_nan(type) method which can be confused with update_nan(bool) because of the silent conversion of pointers to bool. Currently, if you call update_nan(tree), you'll set the possibility of NAN with a sign of true if tree is non-null. This is prone to error and this patch disallows this behavior. gcc/ChangeLog: * value-range.cc (frange::set_nonnegative): Pass bool to update_nan. * value-range.h: Disallow conversion to bool in update_nan(). --- gcc/value-range.cc | 2 +- gcc/value-range.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/value-range.cc b/gcc/value-range.cc index e07d2aa9a5b..26a2b782e2c 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -779,7 +779,7 @@ frange::set_nonnegative (tree type) // Set +NAN as the only possibility. if (HONOR_NANS (type)) - update_nan (/*sign=*/0); + update_nan (/*sign=*/false); } // Here we copy between any two irange's. The ranges can be legacy or diff --git a/gcc/value-range.h b/gcc/value-range.h index 9d630e40f78..cb5e9d0522c 100644 --- a/gcc/value-range.h +++ b/gcc/value-range.h @@ -317,6 +317,7 @@ public: const REAL_VALUE_TYPE &upper_bound () const; void update_nan (); void update_nan (bool sign); + void update_nan (tree) = delete; // Disallow silent conversion to bool. void clear_nan (); // fpclassify like API