[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] maint: accommodate gcc's -Wstrict-overflow option
From: |
Pádraig Brady |
Subject: |
Re: [PATCH 1/2] maint: accommodate gcc's -Wstrict-overflow option |
Date: |
Thu, 26 May 2011 23:05:27 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 |
On 26/05/11 17:06, Jim Meyering wrote:
> There's a nasty bug in gcc, mentioned in log and comments below:
> (It converts a loop that would obviously terminate into one
> that never does, just because a signed accumulator may overflow.
> The crazy part is that the offending accumulator is not related
> to the loop termination condition. )
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33498
>
> Once you read that and understand the implications, you'll
> realize why I (the first to reject -Wstrict-overflow as not
> worth accommodating) have decided that finally it is better
> to use that option than to risk being bitten by the gcc bug.
> -Wstrict-overflow does detect vulnerable code like the
> example in the bug report.
> Accommodating it required changes in 4 programs and tweaks
> to configure.ac so that --enable-gcc-warnings now enables
> that option in src/, but not in lib/ or in gnulib-tests/.
> There would be 3 warnings in lib/ -- for two of them I
> have patches.
Great, something off my todo list :)
The other option is to specify -fno-strict-overflow,
though given the relatively minor changes to accommodate
-Wstrict-overflow[=2], I think this is the way to go.
The changes look good.
cheers,
Pádraig.