From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 814 invoked by alias); 3 Oct 2014 15:46:57 -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 803 invoked by uid 89); 3 Oct 2014 15:46:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: glazunov.sibelius.xs4all.nl Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 03 Oct 2014 15:46:54 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3) with ESMTP id s93FknEW002613; Fri, 3 Oct 2014 17:46:49 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3/Submit) id s93FknOM002165; Fri, 3 Oct 2014 17:46:49 +0200 (CEST) Date: Fri, 03 Oct 2014 15:46:00 -0000 Message-Id: <201410031546.s93FknOM002165@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: gang.chen.5i5j@gmail.com 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 In-reply-to: <542EC11C.3020406@gmail.com> (message from Chen Gang on Fri, 03 Oct 2014 23:30:36 +0800) Subject: Re: [PATCH] gdb/i387-tdep.c: Avoid warning for "-Werror=strict-overflow" References: <542EC11C.3020406@gmail.com> X-SW-Source: 2014-10/txt/msg00068.txt.bz2 > > 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. > 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) >