From patchwork Tue Sep 20 16:29:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 672356 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sdp9v48m7z9sD6 for ; Wed, 21 Sep 2016 02:29:23 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=B8ZS7x6n; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:references:in-reply-to :content-type:content-id:content-transfer-encoding:mime-version; q=dns; s=default; b=nVU64M5DChh5q7BsrijcnvnEPe2sigQzS3y0FFljma0 Ly0BctU17f9nW9fkwKOLQxlolCw+/+/mpAZ42BmLbQB4y0bdHNdlGBhyD5lwjS27 q+xVqjr5Tr2tasZ2gPOVsy1BCjOw25RMpbfQPWvUDhckoUxLMIaR8L38CUdkzORw = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:references:in-reply-to :content-type:content-id:content-transfer-encoding:mime-version; s=default; bh=I7ECTj5zS14Ikz9NPxm7zKbId4M=; b=B8ZS7x6n0rn1c77H1 rNqlaEYwOA4pkXjCE81HMCtFGHsAHguNzzh1T1OQt93hpAufRbCvv1a97UXu33+Y 8L5lLVkq51CCznQvpyqNJgL5SDoGLU8HKF2lHi69U9j6sHcRMasAbz1ZoJLWcbT7 goYYRWORadz7F4n+0BVvAJfLBs= Received: (qmail 89092 invoked by alias); 20 Sep 2016 16:29:14 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 89079 invoked by uid 89); 20 Sep 2016 16:29:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:15.1.619 X-HELO: SNT004-OMC1S19.hotmail.com Received: from snt004-omc1s19.hotmail.com (HELO SNT004-OMC1S19.hotmail.com) (65.55.90.30) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 20 Sep 2016 16:29:13 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com ([65.55.90.8]) by SNT004-OMC1S19.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Tue, 20 Sep 2016 09:29:11 -0700 Received: from DB5EUR03FT056.eop-EUR03.prod.protection.outlook.com (10.152.20.54) by DB5EUR03HT100.eop-EUR03.prod.protection.outlook.com (10.152.21.72) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.629.5; Tue, 20 Sep 2016 16:29:03 +0000 Received: from HE1PR0701MB2169.eurprd07.prod.outlook.com (10.152.20.52) by DB5EUR03FT056.mail.protection.outlook.com (10.152.21.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.619.6 via Frontend Transport; Tue, 20 Sep 2016 16:29:03 +0000 Received: from HE1PR0701MB2169.eurprd07.prod.outlook.com ([10.168.36.18]) by HE1PR0701MB2169.eurprd07.prod.outlook.com ([10.168.36.18]) with mapi id 15.01.0629.006; Tue, 20 Sep 2016 16:29:02 +0000 From: Bernd Edlinger To: Kyrill Tkachov , Bernd Schmidt , Jeff Law , GCC Patches CC: Jason Merrill , Joseph Myers , Trevor Saunders Subject: Re: [PATCHv3, resent] Add a warning for suspicious use of conditional expressions in boolean context Date: Tue, 20 Sep 2016 16:29:02 +0000 Message-ID: References: <8ef95068-7826-ab09-6c22-12dd381aa808@redhat.com> <57E11D80.9080409@foss.arm.com> <57E14591.9000903@foss.arm.com> <53afedf9-3678-50ba-0b59-d9b6c82a8917@redhat.com> <1f90009a-ed08-c657-9d25-198c27827c1f@redhat.com> <57E15FD3.6080505@foss.arm.com> In-Reply-To: <57E15FD3.6080505@foss.arm.com> authentication-results: spf=softfail (sender IP is 10.152.20.52) smtp.mailfrom=hotmail.de; foss.arm.com; dkim=none (message not signed) header.d=none; foss.arm.com; dmarc=none action=none header.from=hotmail.de; received-spf: SoftFail (protection.outlook.com: domain of transitioning hotmail.de discourages use of 10.152.20.52 as permitted sender) x-ms-exchange-messagesentrepresentingtype: 1 x-eopattributedmessage: 0 x-microsoft-exchange-diagnostics: 1; DB5EUR03HT100; 6:m2unBNagkNIvs9eQfvbRIJ9U9LraSTp357s3+cNE6zZuV2g9uG1X91eqbTs0zxOPNCtucBvcisiWkVBreVllvCi6fNPrgAdFWRtJmMWDctPsVKMs1mwtZTsbgpeOGKdVb3QeJnt169rkMEB9DhO1wzdn8dAyRPa403sADPWJBl7X7mx1eI4o92HbeF40D4TYCOhdn/ntjSIdQb/NsXCPt9w21tkb7U2E7eu2ILz/Fchu/kal26jVbecJAPcUtabiu5C58yMci79DcH20dwPEtFXcdFK46rPaQ31aOfsVCHw=; 5:c1CY4JIfb9ujNTtMlaN1gWgvRZsuLiApEW6t4C5OS58ck6i3clYXZVxeJubIDyyTbku0aorSgIHskXC1eFc4RICIi+T6vr9ccrMBX5pTF8CJkb4wL+WySnmrgzES4OHOti98au7kGZdgE80TDrzbKg==; 24:X1vjuTTIu1BZmHS6tTMycEEzev1n4epR+P4MlUBPhYkxt/UYg39PNKUi1be6DnTA2/4GqDVZQHnK8NWRzWlBLm3JZle7O3jMboU+fcj0ZjU=; 7:FU5yvDoJNqX+8G4hXPljlAhefV0U2iuf9+b5FFGj8QvcgGSqCxDEyNTMDOEelsITdUB4hRxUOnoA9WHgIrvpdpg+i/rbgGQNjBLBgSYKpOoAIu2DNMjFLas0XlYCjrzZf1xYLNco/IZf3KcWHiExZSPVzavV10PljJauQnaejnzNojvGnx4/CI/AEdEXJUxrMPTqWYHam03FZQGWaXeoQkwJ213lk1Mj2T1fm1rtEHAbhwrlWh9CR4T1B4+QG0bdhkprmslkLtmCUjvekYvKlsXFicSU/3qWR3BCpgg+BXpGEvbiZPVZ+9LhgeGmmpFo x-forefront-antispam-report: EFV:NLI; SFV:NSPM; SFS:(10019020)(98900003); DIR:OUT; SFP:1102; SCL:1; SRVR:DB5EUR03HT100; H:HE1PR0701MB2169.eurprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; x-ms-office365-filtering-correlation-id: f9b07eb3-91ea-4232-8557-08d3e1733a98 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(1601124038)(1603103081)(1601125047); SRVR:DB5EUR03HT100; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(432015012)(82015046); SRVR:DB5EUR03HT100; BCL:0; PCL:0; RULEID:; SRVR:DB5EUR03HT100; x-forefront-prvs: 0071BFA85B spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <8BE28E09D8F5444997EF6D032DE68194@eurprd07.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Sep 2016 16:29:02.7829 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5EUR03HT100 On 09/20/16 18:12, Kyrill Tkachov wrote: > > On 20/09/16 16:30, Bernd Schmidt wrote: >> On 09/20/2016 05:18 PM, Jeff Law wrote: >>>> I assume HARD_FRAME_POINTER_REGNUM is never zero. >>> It could be zero. It's just a hard register number. No target has the >>> property that its hard frame pointer register is 0 though :-) >> >> git blame to the rescue. The current state comes from one of >> tbsaunde's cleanup patches: >> >> > diff --git a/gcc/regrename.c b/gcc/regrename.c >> index 174d3b5..e5248a5 100644 >> --- a/gcc/regrename.c >> +++ b/gcc/regrename.c >> @@ -442,12 +442,10 @@ rename_chains (void) >> continue; >> >> if (fixed_regs[reg] || global_regs[reg] >> -#if !HARD_FRAME_POINTER_IS_FRAME_POINTER >> - || (frame_pointer_needed && reg == HARD_FRAME_POINTER_REGNUM) >> -#else >> - || (frame_pointer_needed && reg == FRAME_POINTER_REGNUM) >> -#endif >> - ) >> + || (!HARD_FRAME_POINTER_IS_FRAME_POINTER && >> frame_pointer_needed >> + && reg == HARD_FRAME_POINTER_REGNUM) >> + || (HARD_FRAME_POINTER_REGNUM && frame_pointer_needed >> + && reg == FRAME_POINTER_REGNUM)) >> continue; >> >> COPY_HARD_REG_SET (this_unavailable, unavailable); >> >> Looks like it never got reviewed and was committed as preapproved. >> >> The #ifdef we had before looks odd too. Maybe this should just read >> >> if (fixed_regs[reg] || global_regs[reg] >> || (frame_pointer_needed && reg == HARD_FRAME_POINTER_REGNUM)) >> I think this breaks the symmetry with the statement above. how about this (similar to what Jeff suggested): FOR_EACH_VEC_ELT (id_to_chain, i, this_head) @@ -479,10 +478,9 @@ continue; if (fixed_regs[reg] || global_regs[reg] - || (!HARD_FRAME_POINTER_IS_FRAME_POINTER && frame_pointer_needed - && reg == HARD_FRAME_POINTER_REGNUM) - || (HARD_FRAME_POINTER_REGNUM && frame_pointer_needed - && reg == FRAME_POINTER_REGNUM)) + || (frame_pointer_needed + && (reg == HARD_FRAME_POINTER_REGNUM + || reg == FRAME_POINTER_REGNUMi))) continue; COPY_HARD_REG_SET (this_unavailable, unavailable); FRAME_POINTER_REGNUM is always special, and it may be identical with HFP. But it is not necessary to use HARD_FRAME_POINTER_IS_FRAME_POINTER at all. Bernd. > > I'll try bootstrapping and testing this change on arm-none-linux-gnueabihf. > > Thanks, > Kyrill > >> >> Bernd > Index: regrename.c =================================================================== --- regrename.c (revision 240268) +++ regrename.c (working copy) @@ -464,8 +464,7 @@ if (frame_pointer_needed) { add_to_hard_reg_set (&unavailable, Pmode, FRAME_POINTER_REGNUM); - if (!HARD_FRAME_POINTER_IS_FRAME_POINTER) - add_to_hard_reg_set (&unavailable, Pmode, HARD_FRAME_POINTER_REGNUM); + add_to_hard_reg_set (&unavailable, Pmode, HARD_FRAME_POINTER_REGNUM); }