bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xalloc: avoid GCC 5.1 warning on 32 bit


From: Pádraig Brady
Subject: Re: [PATCH] xalloc: avoid GCC 5.1 warning on 32 bit
Date: Fri, 2 Oct 2015 22:48:48 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

On 02/10/15 21:22, Paul Eggert wrote:
> On 10/02/2015 12:24 PM, Pádraig Brady wrote:
>> +/* GCC 5.1 gives an erroneous warning on 32 bit for xalloc_oversized():
>> +   "assuming signed overflow does not occur when simplifying conditional".  
>> */
>> +#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
>> +# pragma GCC diagnostic push
>> +# pragma GCC diagnostic ignored "-Wstrict-overflow"
>> +#endif
> 
> I'm dubious about cluttering the code with this.  -Wstrict-overflow asks 
> the compiler to inform the user when the compiler optimizes the code in 
> a certain way.  In my experience, this option often leads to too much 
> chatter and makework.  A compiler should not notify us about each 
> "interesting" optimization that it does, and we shouldn't need to insert 
> directives like the above merely to suppress the unwanted notifications.
> 
> A better fix for this sort of issue is to not use -Wstrict-overflow.  
> That is what coreutils and Emacs do, for this particular problem.

coreutils does enabled strict-overflow, citing this example:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33498

It does disable the option for gnulib, but xalloc is
included into the coreutils compilation units and so
needs this guard.

thanks,
Pádraig.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]