From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7528 invoked by alias); 14 Oct 2014 21:21:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 7516 invoked by uid 89); 14 Oct 2014 21:21:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f170.google.com Received: from mail-pd0-f170.google.com (HELO mail-pd0-f170.google.com) (209.85.192.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 14 Oct 2014 21:21:38 +0000 Received: by mail-pd0-f170.google.com with SMTP id p10so8295094pdj.29 for ; Tue, 14 Oct 2014 14:21:36 -0700 (PDT) X-Received: by 10.67.30.17 with SMTP id ka17mr7540430pad.62.1413321696612; Tue, 14 Oct 2014 14:21:36 -0700 (PDT) Received: from [192.168.1.103] ([223.72.65.33]) by mx.google.com with ESMTPSA id jc3sm12091832pbb.49.2014.10.14.14.21.34 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 14 Oct 2014 14:21:35 -0700 (PDT) Message-ID: <543D93DD.5000906@gmail.com> Date: Tue, 14 Oct 2014 21:21:00 -0000 From: Chen Gang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [PATCH] gdb/hppa-tdep.c: Fix a logical typo bug found by compiler warning Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-10/txt/msg00374.txt.bz2 '(inst >> 6) & 0xf)' need compare with both '0x8' and '0x9', original implementation missed additional '(' and ')' for it, which will cause logical bug (will skip '0x8' checking). The related warning under gcc5: gcc -g -O2 -I. -I../../binutils-gdb/gdb -I../../binutils-gdb/gdb/common -I../../binutils-gdb/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I../../binutils-gdb/gdb/../include/opcode -I../../binutils-gdb/gdb/../opcodes/.. -I../../binutils-gdb/gdb/../readline/.. -I../bfd -I../../binutils-gdb/gdb/../bfd -I../../binutils-gdb/gdb/../include -I../libdecnumber -I../../binutils-gdb/gdb/../libdecnumber -I../../binutils-gdb/gdb/gnulib/import -Ibuild-gnulib/import -DTUI=1 -I/usr/include/python2.7 -I/usr/include/python2.7 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition -Wformat-nonliteral -Werror -c -o hppa-tdep.o -MT hppa-tdep.o -MMD -MP -MF .deps/hppa-tdep.Tpo ../../binutils-gdb/gdb/hppa-tdep.c ../../binutils-gdb/gdb/hppa-tdep.c: In function 'inst_saves_gr': ../../binutils-gdb/gdb/hppa-tdep.c:1406:30: error: comparison of constant '9' with boolean expression is always false [-Werror=bool-compare] || (inst >> 6) & 0xf) == 0x9)) ^ cc1: all warnings being treated as errors Signed-off-by: Chen Gang --- gdb/hppa-tdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 627f31a..51edead 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -1403,7 +1403,7 @@ inst_saves_gr (unsigned long inst) if ((inst >> 26) == 0x19 || (inst >> 26) == 0x18 || ((inst >> 26) == 0x3 && (((inst >> 6) & 0xf) == 0x8 - || (inst >> 6) & 0xf) == 0x9)) + || ((inst >> 6) & 0xf) == 0x9))) return hppa_extract_5R_store (inst); return 0; -- 1.9.3