Message ID | 12106563.O9o76ZdvQC@fomalhaut |
---|---|
State | Repeat Merge |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3877282wrr; Fri, 25 Nov 2022 01:22:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf5wqlqtHO60T7bc+/WaBAu0JTgZfUIY8hVx+z2Ctgnwngl0lNhDb17YC55WjqJN2K9bzDaH X-Received: by 2002:a17:906:1e83:b0:78d:addf:67c3 with SMTP id e3-20020a1709061e8300b0078daddf67c3mr22185531ejj.253.1669368161110; Fri, 25 Nov 2022 01:22:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669368161; cv=none; d=google.com; s=arc-20160816; b=FDQuKUtOLrCCSqrKC7p6jLCfnUc7LqlGFFNvORNVuezOoS+dOD3EOGSjiU2iT9Om0I TT0oQnmklQU4b6kJEfHNPoRkPrSlQdzZ6w2S8dBEZTPS0wLjKJAex+ENHWsLhtC3ZTyC PxcZU6Irl7M8NQGn8s8hRk0LDnZxLPAfP1ArkYLIXzSxfs+oTGChmSZ+T1rtZUGe/UTt dTWR0s3fC3mT30OTThB8/EIUxdfCLxAWSvLH/aGJhHGAnvYzyy+UZPn8h9IF3SFd+xbh krYeaeruUC+SvQunNh3Vr5KCOVPPkyfewrQaNfGd6TBahidP+eGTBkcJb6w2UFv9hrys EGQQ== 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:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=MEJJgNFl4YsPV/4zdMGR74XP/4S440p7v5HVaX/kFaw=; b=Y0ucdsp909AZGF3zzkEMH3RUchF8R3ln3EAjzLJho06xO1XxMU5JRb569nvD0uVJWc KgK07aAewZbJ77dCA7+LvB0CLsjC0yg7U1QP1GT0guXfHTLcuCRHKdHbKsOMPI8sMjMh Hs4ndZUwwjhXmwj6Uq3sOah06HHjO0Fn8uEaqJMBEBkMdUacCPBCzMF4cFHXei2yM/hF OEIKpw+rtjw8RJIjR5TONoc6Ham0B0PisaZuM0jjBchko//d6TjgTUPeveyOD2hmrgeH 8ELEf03qL+cTl1VDxHu+eQoNHguQOnXpfojN5IbHF7Z6hEXqwOHL+S1bkw4KN+4BJcAo P1bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=FOcKGUet; 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 ne3-20020a1709077b8300b007ad6a0afbc6si2440726ejc.7.2022.11.25.01.22.40 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Nov 2022 01:22:41 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=FOcKGUet; 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 E5070385B19C for <ouuuleilei@gmail.com>; Fri, 25 Nov 2022 09:22:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E5070385B19C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669368159; bh=MEJJgNFl4YsPV/4zdMGR74XP/4S440p7v5HVaX/kFaw=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=FOcKGUet2rHaHsMiOuFf4DxhqczWNEHdX/D3soia7RGU8kaBwSLvrRUrDuuDJ2z0W XEuo3a6Hc17SUJaFbRLd6Uq1JLN8ca2Tag13JyB2jBuYlW4xZjmcYA77lytgWf9GYA Y/y7UoJffEACzYOold81zeBArtFC5uibfsORhOnE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id 87A8B385B18F for <gcc-patches@gcc.gnu.org>; Fri, 25 Nov 2022 09:21:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 87A8B385B18F Received: by mail-wm1-x333.google.com with SMTP id p16so2988705wmc.3 for <gcc-patches@gcc.gnu.org>; Fri, 25 Nov 2022 01:21:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MEJJgNFl4YsPV/4zdMGR74XP/4S440p7v5HVaX/kFaw=; b=CAOhK08eEAl7spBBqNeMLJTCOhdW3yZ6AuSQNB+wHcsOUStebp5HycgtYXp5+6IIEb sb/bzLoA6+aqOmMoJoXuwXUwwSLpl9NZvfqyOZ++FMhySkAdYgy/W09hGjPfSN1Udheo l5cAm46muR5nMxUwCMB9O6ayMIuyHeQKSXLmqLkDgqS0Yp5mfUDjOaR3aMMV2GGDxobF Q9zgx+Mkwn5kSb+NDFsDdBGufBuYZBA5fvwGCLmRYNRR02KggBx+M8cPbD2/O/jPgmle 7obMnH6XV//EXM/fvXZTl+SsS4CBSfRS9eeXoI/ItJiSVeoHzsQ+HDXyu/3GkhYdlDaE bTxw== X-Gm-Message-State: ANoB5pnmugNsMYPQ5OHVEm0nJD1EoCY9rk2kJ7V672mruBKU1OX8eo5u 8RU7qc0hmI7Wq8tenm2w41vQ9houZ2JSJQ== X-Received: by 2002:a1c:e903:0:b0:3a8:4d01:28e8 with SMTP id q3-20020a1ce903000000b003a84d0128e8mr15300889wmc.94.1669368113978; Fri, 25 Nov 2022 01:21:53 -0800 (PST) Received: from fomalhaut.localnet ([2a01:e0a:8d5:d990:e654:e8ff:fe8f:2ce6]) by smtp.gmail.com with ESMTPSA id j8-20020adff548000000b002367ad808a9sm3266404wrp.30.2022.11.25.01.21.52 for <gcc-patches@gcc.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Nov 2022 01:21:53 -0800 (PST) X-Google-Original-From: Eric Botcazou <ebotcazou@adacore.com> To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix thinko in operator_bitwise_xor::op1_range Date: Fri, 25 Nov 2022 10:21:52 +0100 Message-ID: <12106563.O9o76ZdvQC@fomalhaut> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart5630461.DvuYhMxLoT" Content-Transfer-Encoding: 7Bit X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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: Eric Botcazou via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Eric Botcazou <botcazou@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?1750459389011222107?= X-GMAIL-MSGID: =?utf-8?q?1750459389011222107?= |
Series |
Fix thinko in operator_bitwise_xor::op1_range
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Eric Botcazou
Nov. 25, 2022, 9:21 a.m. UTC
Hi, there is a thinko in the op1_range method of ranger's operator_bitwise_xor class in a boolean context: if the result is known to be true, it may infer than a specific operand is false without any basis. Tested on x86-64/Linux, OK for mainline, 12 and 11 branches? 2022-11-25 Eric Botcazou <ebotcazou@adacore.com> * range-op.cc (operator_bitwise_xor::op1_range): Fix thinko. 2022-11-25 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/opt100.adb: New test. * gnat.dg/opt100_pkg.adb, gnat.dg/opt100_pkg.ads: New helper.
Comments
On Fri, Nov 25, 2022 at 10:22 AM Eric Botcazou via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > Hi, > > there is a thinko in the op1_range method of ranger's operator_bitwise_xor > class in a boolean context: if the result is known to be true, it may infer > than a specific operand is false without any basis. > > Tested on x86-64/Linux, OK for mainline, 12 and 11 branches? OK. Thanks, Richard. > > 2022-11-25 Eric Botcazou <ebotcazou@adacore.com> > > * range-op.cc (operator_bitwise_xor::op1_range): Fix thinko. > > > 2022-11-25 Eric Botcazou <ebotcazou@adacore.com> > > * gnat.dg/opt100.adb: New test. > * gnat.dg/opt100_pkg.adb, gnat.dg/opt100_pkg.ads: New helper. > > -- > Eric Botcazou
diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 6fa3b151596..daea084ce18 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -3501,6 +3501,9 @@ operator_bitwise_xor::op1_range (irange &r, tree type, r.set_varying (type); else if (op2.zero_p ()) r = range_true (type); + // See get_bool_state for the rationale + else if (op2.contains_p (build_zero_cst (op2.type ()))) + r = range_true_and_false (type); else r = range_false (type); break;