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.
