From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id C8B8A3851C2D for ; Sat, 16 May 2020 02:01:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C8B8A3851C2D X-ASG-Debug-ID: 1589594513-0c856e314b90def0001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id DXvf03Fo7NSDFBIq (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 15 May 2020 22:01:53 -0400 (EDT) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from smarchi-efficios.lan (unknown [192.222.164.54]) by smtp.ebox.ca (Postfix) with ESMTP id E67A9441B21; Fri, 15 May 2020 22:01:52 -0400 (EDT) From: Simon Marchi X-Barracuda-Effective-Source-IP: 192-222-164-54.qc.cable.ebox.net[192.222.164.54] X-Barracuda-Apparent-Source-IP: 192.222.164.54 X-Barracuda-RBL-IP: 192.222.164.54 To: gdb-patches@sourceware.org Cc: macro@linux-mips.org, Simon Marchi Subject: [PATCH] gdb: fix -Wtautological-overlap-compare warning in mips-linux-tdep.c Date: Fri, 15 May 2020 22:01:51 -0400 X-ASG-Orig-Subj: [PATCH] gdb: fix -Wtautological-overlap-compare warning in mips-linux-tdep.c Message-Id: <20200516020151.34919-1-simon.marchi@efficios.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1589594513 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 1753 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.81880 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-22.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2020 02:01:55 -0000 When building with clang 11, I get: CXX mips-linux-tdep.o /home/smarchi/src/binutils-gdb/gdb/mips-linux-tdep.c:643:30: error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare] if (insn != 0x03e07821 || insn != 0x03e07825) ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ /home/smarchi/src/binutils-gdb/gdb/mips-linux-tdep.c:636:30: error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare] if (insn != 0x03e0782d || insn != 0x03e07825) ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ Indeed, given two different values, `insn` will always be different to one of them, and these conditions always be true. I suppose that the original intent was "if insn is equal to this instruction or equal to that instruction". Therefore the `!=` should be changed to `==`. gdb/ChangeLog: * mips-linux-tdep.c (mips_linux_in_dynsym_stub): Fix condition. --- gdb/mips-linux-tdep.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index aa7b8d11f3fb..ae067c19dfa7 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -633,16 +633,14 @@ mips_linux_in_dynsym_stub (CORE_ADDR pc) if (n64) { /* 'daddu t7,ra' or 'or t7, ra, zero'*/ - if (insn != 0x03e0782d || insn != 0x03e07825) + if (insn == 0x03e0782d || insn == 0x03e07825) return 0; - } else { /* 'addu t7,ra' or 'or t7, ra, zero'*/ - if (insn != 0x03e07821 || insn != 0x03e07825) + if (insn == 0x03e07821 || insn == 0x03e07825) return 0; - } insn = extract_unsigned_integer (p + 8, 4, byte_order); -- 2.26.2