This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb/i387-tdep.c: Avoid warning for "-Werror=strict-overflow"
- From: Chen Gang <gang dot chen dot 5i5j at gmail dot com>
- To: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Cc: amodra at gmail dot com, gbenson at redhat dot com, michael dot sturm at intel dot com, brobecker at adacore dot com, walfred dot tedeschi at intel dot com, binutils at sourceware dot org, gdb-patches at sourceware dot org
- Date: Sat, 04 Oct 2014 00:08:28 +0800
- Subject: Re: [PATCH] gdb/i387-tdep.c: Avoid warning for "-Werror=strict-overflow"
- Authentication-results: sourceware.org; auth=none
- References: <542EC11C dot 3020406 at gmail dot com> <201410031546 dot s93FknOM002165 at glazunov dot sibelius dot xs4all dot nl>
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 <gang.chen.5i5j@gmail.com>
>>
>> *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