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: Paul Eggert
Subject: Re: [PATCH] xalloc: avoid GCC 5.1 warning on 32 bit
Date: Fri, 2 Oct 2015 13:22:16 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

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.



reply via email to

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