From patchwork Tue Nov 9 19:03:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 47332 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A520C3858039 for ; Tue, 9 Nov 2021 19:08:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A520C3858039 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1636484920; bh=OZEXzSIfapCK0iXZe3x8oecohkYyAyRiop+OofroIOs=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=fZApcnWuQa50wn06E5MdUELkBUMUBAIp1WcvKDl/y5W/rOgV1x15JiVLfuRN+QOuE nIeEVuGPZCIjkEumXv4NdEKDApObyu6/kKdn3qSttnvCdZUnkXXoYFE1sFbqkDFtpY Dy0GyswxapUgx5Ed4N/8czE48QMdlSIELHHSc6eY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by sourceware.org (Postfix) with ESMTPS id 2A2CC385AC0A for ; Tue, 9 Nov 2021 19:03:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2A2CC385AC0A Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1A9IsCI1019335 for ; Tue, 9 Nov 2021 11:03:44 -0800 Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3c7xp401h2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 09 Nov 2021 11:03:43 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 9 Nov 2021 11:03:42 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 9 Nov 2021 11:03:42 -0800 Received: from linux.wrightpinski.org.com (unknown [10.69.242.198]) by maili.marvell.com (Postfix) with ESMTP id 65E873F7074; Tue, 9 Nov 2021 11:03:42 -0800 (PST) To: Subject: [PATCH] [Committed] Fix tree-optimization/103152: Still one more -signed1bit issue Date: Tue, 9 Nov 2021 11:03:29 -0800 Message-ID: <1636484609-29018-1-git-send-email-apinski@marvell.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Proofpoint-GUID: dfzBQlYFOaC0AUW6iJx3xGPL-ZGXkLVt X-Proofpoint-ORIG-GUID: dfzBQlYFOaC0AUW6iJx3xGPL-ZGXkLVt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-09_05,2021-11-08_02,2020-04-07_01 X-Spam-Status: No, score=-14.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: apinski--- via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: apinski@marvell.com Cc: Andrew Pinski Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Andrew Pinski When I fixed PR 102622, I accidently left behind a TYPE_PRECISION check which I had there for checking before hand. This check is not needed as the code will handle it correctly anyways. Committed as obvious after a bootstrap/test on x86_64-linux-gnu. PR tree-optimization/10352 gcc/ChangeLog: * match.pd: Remove check of TYPE_PRECISION for the a?0:pow2 case. gcc/testsuite/ChangeLog: * gcc.c-torture/execute/pr10352-1.c: New test. --- gcc/match.pd | 3 +-- gcc/testsuite/gcc.c-torture/execute/pr10352-1.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr10352-1.c diff --git a/gcc/match.pd b/gcc/match.pd index cdab5e59f4e..986b052bc93 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -4056,8 +4056,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (if (integer_onep (@2)) (convert (bit_xor (convert:boolean_type_node @0) { booltrue; } ))) /* a ? powerof2cst : 0 -> (!a) << (log2(powerof2cst)) */ - (if (INTEGRAL_TYPE_P (type) && integer_pow2p (@2) - && TYPE_PRECISION (type) != 1) + (if (INTEGRAL_TYPE_P (type) && integer_pow2p (@2)) (with { tree shift = build_int_cst (integer_type_node, tree_log2 (@2)); } diff --git a/gcc/testsuite/gcc.c-torture/execute/pr10352-1.c b/gcc/testsuite/gcc.c-torture/execute/pr10352-1.c new file mode 100644 index 00000000000..babb9d45a28 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr10352-1.c @@ -0,0 +1,12 @@ +/* this is another case where phiopt + would create -signed1bit which is undefined. */ +struct { + int a:1; +} b; +int *c = (int *)&b, d; +int main() { + d = c && (b.a = (d < 0) ^ 3); + if (d != 1) + __builtin_abort(); + return 0; +}