From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 97DB13858407; Thu, 3 Mar 2022 14:18:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 97DB13858407 From: "dmalcolm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/104680] identical inner condition not detected Date: Thu, 03 Mar 2022 14:18:41 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: analyzer X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: dmalcolm at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dmalcolm at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Mar 2022 14:18:41 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104680 --- Comment #2 from David Malcolm --- > trunk.git/gcc/config/avr/avr.cc:8674:22: warning: Identical inner 'if' co= ndition is always true. [identicalInnerCondition] In avr_out_fract: 8665 =E2=94=82 /* We need to consider to-be-discarded bits 8666 =E2=94=82 if the value is negative. */ 8667 =E2=94=82 if (sn < s0) 8668 =E2=94=82 { 8669 =E2=94=82 avr_asm_len ("tst %0" CR_TAB 8670 =E2=94=82 "brpl 0f", 8671 =E2=94=82 &all_regs_rtx[src.regno_msb], p= len, 2); 8672 =E2=94=82 /* Test to-be-discarded bytes for any nozero= bits. 8673 =E2=94=82 ??? Could use OR or SBIW to test two regi= sters at once. */ 8674 =E2=94=82 if (sn < s0) 8675 =E2=94=82 avr_asm_len ("cp %0,__zero_reg__", &all_re= gs_rtx[sn], plen, 1); 8676 =E2=94=82=20 sn < s0 is checked at line 8667, then again at line 8675.=