From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16519 invoked by alias); 3 Oct 2014 16:02:46 -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 16502 invoked by uid 89); 3 Oct 2014 16:02:45 -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-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-pd0-f179.google.com Received: from mail-pd0-f179.google.com (HELO mail-pd0-f179.google.com) (209.85.192.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 03 Oct 2014 16:02:44 +0000 Received: by mail-pd0-f179.google.com with SMTP id r10so2819683pdi.10 for ; Fri, 03 Oct 2014 09:02:42 -0700 (PDT) X-Received: by 10.68.204.163 with SMTP id kz3mr8011368pbc.53.1412352162829; Fri, 03 Oct 2014 09:02:42 -0700 (PDT) Received: from ShengShiZhuChengdeMacBook-Pro.local ([223.72.65.80]) by mx.google.com with ESMTPSA id fm15sm4498294pdb.58.2014.10.03.09.02.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Oct 2014 09:02:41 -0700 (PDT) Message-ID: <542EC9FC.8050107@gmail.com> Date: Fri, 03 Oct 2014 16:02:00 -0000 From: Chen Gang User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: Mark Kettenis CC: amodra@gmail.com, gbenson@redhat.com, michael.sturm@intel.com, brobecker@adacore.com, walfred.tedeschi@intel.com, binutils@sourceware.org, gdb-patches@sourceware.org Subject: Re: [PATCH] gdb/i387-tdep.c: Avoid warning for "-Werror=strict-overflow" References: <542EC11C.3020406@gmail.com> <201410031546.s93FknOM002165@glazunov.sibelius.xs4all.nl> In-Reply-To: <201410031546.s93FknOM002165@glazunov.sibelius.xs4all.nl> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-10/txt/msg00069.txt.bz2 On 10/3/14 23:46, Mark Kettenis wrote: >> >> gdb requires "-Werror", and I387_ST0_REGNUM (tdep) is 'variable', then >> compiler can think that I387_ST0_REGNUM (tdep) may be a large number, >> which may cause issue, so report warning. > > Sorry, but obfuscating code to make compilers happy is *not* the way to go. > OK, I can understand, but for me, these is no other better ways for it, except let gdb give up "-Werror" (if always need "--disable-werror" during "configure"). Thanks. >> 2014-10-03 Chen Gang >> >> *i387-tdep.c (i387_supply_fsave): Avoid warning for >> "-Werror=strict-overflow" >> --- >> gdb/i387-tdep.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c >> index d66ac6a..c89e647 100644 >> --- a/gdb/i387-tdep.c >> +++ b/gdb/i387-tdep.c >> @@ -454,7 +454,7 @@ i387_supply_fsave (struct regcache *regcache, int regnum, const void *fsave) >> >> gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM); >> >> - for (i = I387_ST0_REGNUM (tdep); i < I387_XMM0_REGNUM (tdep); i++) >> + for (i = I387_ST0_REGNUM (tdep); I387_XMM0_REGNUM (tdep) - i > 0; i++) >> if (regnum == -1 || regnum == i) >> { >> if (fsave == NULL) >> @@ -507,7 +507,7 @@ i387_collect_fsave (const struct regcache *regcache, int regnum, void *fsave) >> >> gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM); >> >> - for (i = I387_ST0_REGNUM (tdep); i < I387_XMM0_REGNUM (tdep); i++) >> + for (i = I387_ST0_REGNUM (tdep); I387_XMM0_REGNUM (tdep) - i > 0; i++) >> if (regnum == -1 || regnum == i) >> { >> /* Most of the FPU control registers occupy only 16 bits in >> -- >> 1.8.5.2 (Apple Git-48) >> -- Chen Gang Open, share, and attitude like air, water, and life which God blessed