coreutils failed to build when configured with --enable-gcc-warnings
and the latest gcc built from git.

Here's a patch to fix that:
From e22ff987e4d3c29b445b3e94de65c633f8a05870 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Tue, 3 May 2016 20:56:20 -0700
Subject: [PATCH] maint: avoid new warning from gcc (GCC) 7.0.0 20160503
 (experimental)

* src/id.c (main): When configured with --enable-gcc-warnings and using
the very latest gcc built from git, building would fail with this:
  src/id.c:200:8: error: assuming signed overflow does not occur when \
    simplifying conditional to constant [-Werror=strict-overflow]
     bool default_format = (just_user + just_group + just_group_list
          ^~~~~~~~~~~~~~
Add "U0" to those boolean addends, to avoid the warning by widening
the type of the sum.
---
 src/id.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/id.c b/src/id.c
index 38844af..3969337 100644
--- a/src/id.c
+++ b/src/id.c
@@ -197,7 +197,7 @@ main (int argc, char **argv)
   if (just_user + just_group + just_group_list + just_context > 1)
     error (EXIT_FAILURE, 0, _("cannot print \"only\" of more than one choice"));

-  bool default_format = (just_user + just_group + just_group_list
+  bool default_format = (0U + just_user + just_group + just_group_list
                          + just_context == 0);

   if (default_format && (use_real || use_name))
-- 
2.8.0-rc2

Reply via email to