Subject: bug#22900: new snapshot available: gzip-1.6.42-d6d4

From: Paul Eggert <[email-masked]>
Date: Sun, 6 Mar 2016 16:50:41 -0800

Assaf Gordon wrote:

> the following occur on Mac OS X 10.10.4 (and perhaps others, didn't check):
> ===
>    CC       error.o
> error.c:386:12: error: data argument not used by format string [-Werror,-Wformat-extra-args]
>             file_name, line_number);
>             ^
 > ...
>    CC       memrchr.o
> memrchr.c:71:18: error: cast from 'const unsigned char *' to 'const longword *' (aka 'const unsigned long *')
>        increases required alignment from 1 to 8 [-Werror,-Wcast-align]
>    longword_ptr = (const longword *) char_ptr;
>                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~

The above are longstanding Clang false alarms, not easily worked around as far 
as I know. We can safely ignore them.

> ===
>    CC       gzip.o
> gzip.c:1770:20: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int]
>                     + 4 * tm->tm_mon),
>                     ^~~~~~~~~~~~~~~~
> gzip.c:1770:20: note: use array indexing to silence this warning
>                     + 4 * tm->tm_mon),
>                     ^

Thanks, I reproduced that with clang on Fedora 23 and worked around it by 
installing the attached patch.
>From 06b1a911a8b949cb1ea0226e9c2e8dfe2464fafe Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Sun, 6 Mar 2016 16:47:22 -0800
Subject: [PATCH] gzip: pacify clang

* gzip.c (do_list): Use 2D array of char for month abbreviations,
as this is clearer anyway, and it pacifies Clang.  Problem reported
by Assaf Gordon in: http://bugs.gnu.org/22900#40
---
 gzip.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gzip.c b/gzip.c
index 1618f19..61b19fb 100644
--- a/gzip.c
+++ b/gzip.c
@@ -1762,12 +1762,13 @@ local void do_list(ifd, method)
 
     if (verbose)
       {
+        static char const month_abbr[][4]
+          = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+              "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
         struct tm *tm = localtime (&time_stamp.tv_sec);
         printf ("%5s %08lx ", methods[method], crc);
         if (tm)
-          printf ("%s%3d %02d:%02d ",
-                  ("Jan\0Feb\0Mar\0Apr\0May\0Jun\0Jul\0Aug\0Sep\0Oct\0Nov\0Dec"
-                   + 4 * tm->tm_mon),
+          printf ("%s%3d %02d:%02d ", month_abbr[tm->tm_mon],
                   tm->tm_mday, tm->tm_hour, tm->tm_min);
         else
           printf ("??? ?? ??:?? ");
-- 
2.5.0