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.

Reply via email to