]> Savannah Git Hosting - gnulib.git/commitdiff
Fix "warning: integer overflow in expression".
authorBruno Haible <bruno@clisp.org>
Sun, 16 Aug 2020 11:00:51 +0000 (13:00 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 16 Aug 2020 11:00:51 +0000 (13:00 +0200)
* tests/test-strtol.c (main): Use an 'unsigned long' expression to
remove a 'long' overflow.

ChangeLog
tests/test-strtol.c

index 56e893b13d23ad804d66c4b11af77630d3a48079..696aefc76d17fa416b99d1482c3e128ec991e3e2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2020-08-16  Bruno Haible  <bruno@clisp.org>
 
+       Fix "warning: integer overflow in expression".
+       * tests/test-strtol.c (main): Use an 'unsigned long' expression to
+       remove a 'long' overflow.
+
        Fix "warning: "getpagesize" redefined".
        * tests/test-getcwd.c (getpagesize): Don't redefine if defined as a
        macro.
index 8d523c25da4cf5a9c33359c9887e0b64545118e8..d33ac12f50c5cb19abd0fcedcb94d859ac9177ca 100644 (file)
@@ -172,7 +172,7 @@ main (void)
       long result;
       errno = 0;
       result = strtol (input, &ptr, 10);
-      ASSERT (result == 65535L * 65537L);
+      ASSERT (result == (long) 4294967295UL);
       ASSERT (ptr == input + 10);
       ASSERT (errno == 0);
     }