Subject: maint: avoid md5sum.c warning from bleeding-edge gcc's -Wstrict-overflow

From: Jim Meyering <[email-masked]>
Date: Wed, 22 Jun 2016 07:37:07 -0700

Building with a recent gcc-7 failed, so I wrote the attached patch. I
think we'll never have 2^31 command line arguments, so "unsigned int"
will ll be ok:

    maint: avoid md5sum.c warning from bleeding-edge gcc's -Wstrict-overflow

    Avoid this warning/error from gcc:
      src/md5sum.c:870:3: error: assuming signed overflow does not occur \
      when simplifying conditional to constant [-Werror=strict-overflow]
    * src/md5sum.c (main): Use an unsigned variable as the loop index,
    rather than optind.
From 8912aa7c6dc7acb76d2de648e89098943bfe149a Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Wed, 22 Jun 2016 07:18:16 -0700
Subject: [PATCH] maint: avoid md5sum.c warning from bleeding-edge gcc's
 -Wstrict-overflow

Avoid this warning/error from gcc:
  src/md5sum.c:870:3: error: assuming signed overflow does not occur \
  when simplifying conditional to constant [-Werror=strict-overflow]
* src/md5sum.c (main): Use an unsigned variable as the loop index,
rather than optind.
---
 src/md5sum.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/md5sum.c b/src/md5sum.c
index 39132e3..fa2840b 100644
--- a/src/md5sum.c
+++ b/src/md5sum.c
@@ -867,9 +867,9 @@ main (int argc, char **argv)
   if (optind == argc)
     argv[argc++] = bad_cast ("-");

-  for (; optind < argc; ++optind)
+  for (unsigned int j = optind; j < argc; ++j)
     {
-      char *file = argv[optind];
+      char *file = argv[j];

       if (do_check)
         ok &= digest_check (file);
-- 
2.8.0-rc2