]> Savannah Git Hosting - gnulib.git/commitdiff
intprops-test: work around GCC bug 68971
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 17 Dec 2015 20:56:55 +0000 (12:56 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 17 Dec 2015 20:57:52 +0000 (12:57 -0800)
Problem reported by Pádraig Brady in:
http://lists.gnu.org/archive/html/bug-gnulib/2015-12/msg00011.html
* tests/test-intprops.c: Ignore -Woverflow in GCC 6 and earlier.
(main): Add a case that better tests 64-bit long in this area.

ChangeLog
tests/test-intprops.c

index 6bc0a4921f191f09b36254f752e994fb79c8f694..4fb4b97db88e0596cb951b8561135eef4df354a5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-12-17  Paul Eggert  <eggert@cs.ucla.edu>
+
+       intprops-test: work around GCC bug 68971
+       Problem reported by Pádraig Brady in:
+       http://lists.gnu.org/archive/html/bug-gnulib/2015-12/msg00011.html
+       * tests/test-intprops.c: Ignore -Woverflow in GCC 6 and earlier.
+       (main): Add a case that better tests 64-bit long in this area.
+
 2015-12-09  Pavel Raiskup  <praiskup@redhat.com>
 
        gnulib-tool: allow multiple --local-dir usage
index 6b1141756253b2c2fb8b40f3b529eed282e0e428..82dc9bf590c1c5306e50916eb738142bb639419a 100644 (file)
 #if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
 # pragma GCC diagnostic ignored "-Woverlength-strings"
 # pragma GCC diagnostic ignored "-Wtype-limits"
+
+/* Work around a bug in GCC 5.3.1 and earlier; see:
+   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68971
+   Hope it will be fixed by the time GCC 6 comes out.  */
+# if __GNUC__ < 6
+#  pragma GCC diagnostic ignored "-Woverflow"
+# endif
+
 #endif
 
 #include <config.h>
@@ -30,6 +38,7 @@
 
 #include <stdbool.h>
 #include <inttypes.h>
+#include <limits.h>
 
 #include "macros.h"
 
@@ -328,6 +337,18 @@ main (void)
             || result == INT_MIN * (long int) INT_MIN);
   }
 
+# ifdef LLONG_MAX
+  {
+    long long int result;
+    ASSERT (INT_MULTIPLY_WRAPV (LONG_MAX, LONG_MAX, &result)
+            == (LLONG_MAX / LONG_MAX < LONG_MAX));
+    ASSERT (INT_MULTIPLY_WRAPV (LONG_MAX, LONG_MAX, &result)
+            || result == LONG_MAX * (long long int) LONG_MAX);
+    ASSERT (INT_MULTIPLY_WRAPV (LONG_MIN, LONG_MIN, &result)
+            || result == LONG_MIN * (long long int) LONG_MIN);
+  }
+# endif
+
   #define CHECK_QUOTIENT(a, b, v) VERIFY (INT_DIVIDE_OVERFLOW (a, b) == (v))
 
   CHECK_QUOTIENT (INT_MIN, -1L,