From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout2.freenet.de (mout2.freenet.de [IPv6:2001:748:100:40::2:4]) by sourceware.org (Postfix) with ESMTPS id 314CE385E024 for ; Fri, 27 Mar 2020 19:28:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 314CE385E024 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=justmail.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=gnikl@justmail.de Received: from [195.4.92.165] (helo=mjail2.freenet.de) by mout2.freenet.de with esmtpa (ID gnikl@justmail.de) (port 25) (Exim 4.92 #3) id 1jHue9-0007Zw-De for binutils@sourceware.org; Fri, 27 Mar 2020 20:28:01 +0100 Received: from [::1] (port=56384 helo=mjail2.freenet.de) by mjail2.freenet.de with esmtpa (ID gnikl@justmail.de) (Exim 4.92 #3) id 1jHue9-00023N-BT for binutils@sourceware.org; Fri, 27 Mar 2020 20:28:01 +0100 Received: from sub1.freenet.de ([195.4.92.120]:37444) by mjail2.freenet.de with esmtpa (ID gnikl@justmail.de) (Exim 4.92 #3) id 1jHubq-0001Uh-If for binutils@sourceware.org; Fri, 27 Mar 2020 20:25:38 +0100 Received: from p5b3b337c.dip0.t-ipconnect.de ([91.59.51.124]:49413 helo=localhost) by sub1.freenet.de with esmtpsa (ID gnikl@justmail.de) (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256) (port 465) (Exim 4.92 #3) id 1jHubq-0001Mn-FH for binutils@sourceware.org; Fri, 27 Mar 2020 20:25:38 +0100 Date: Fri, 27 Mar 2020 20:25:26 +0100 From: Gunther Nikl To: binutils Subject: [PATCH gas/m68k] Fix a register range check Message-ID: <20200327202526.0000445d@justmail.de> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Originated-At: 91.59.51.124!49413 X-Spam-Status: No, score=-21.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Mar 2020 19:28:06 -0000 Hello! Building an older binutils version with clang 10 produced an unexpected warning message: "overlapping comparisons always evaluate to true". And indeed, a register range check erroneously used a "logical or" instead of an "and". This bug is still present in master. Checking the history of tc-m68k.c shows that this particular bug is really an ancient one. It was introduced with the creation of the bison grammar for operand parsing in 1995! Regards, Gunther Nikl 2020-03-27 Gunther Nikl * config/tc-m68k.c (m68k_ip): Fix range check for index register with a suppressed address register. -- cut -- diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index 5483f8e017..fef91706c1 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -2794,7 +2797,7 @@ m68k_ip (char *instring) && opP->index.reg <= ZDATA7) nextword |= (opP->index.reg - ZDATA0) << 12; else if (opP->index.reg >= ZADDR0 - || opP->index.reg <= ZADDR7) + && opP->index.reg <= ZADDR7) nextword |= (opP->index.reg - ZADDR0 + 8) << 12; } -- cut --