>From b89753158c93eae6acba2ecb5af48ccae8f92b35 Mon Sep 17 00:00:00 2001
From: Andreas Stieger <astieger@suse.com>
Date: Tue, 28 Feb 2017 16:28:32 +0100
Subject: [PATCH] Fix warnings if !ALL_STATE: address of gmtmem always
 evaluates as true

* localtime.c (gmtcheck) [!ALL_STATE]: move null check inside macro conditional.
(gmtsub): split ternary.
---
 localtime.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/localtime.c b/localtime.c
index afc7438..63e11cc 100644
--- a/localtime.c
+++ b/localtime.c
@@ -1353,8 +1353,8 @@ gmtcheck(void)
   if (! gmt_is_set) {
 #ifdef ALL_STATE
     gmtptr = malloc(sizeof *gmtptr);
-#endif
     if (gmtptr)
+#endif
       gmtload(gmtptr);
     gmt_is_set = true;
   }
@@ -1545,7 +1545,14 @@ gmtsub(struct state const *sp, time_t const *timep, int_fast32_t offset,
 	** but this is no time for a treasure hunt.
 	*/
 	tmp->TM_ZONE = ((char *)
-			(offset ? wildabbr : gmtptr ? gmtptr->chars : gmt));
+			(offset ? wildabbr :
+#ifdef ALL_STATE
+			gmtptr ? gmtptr->chars : gmt
+#else
+			gmtptr->chars
+#endif /* defined ALL_STATE */
+			));
+
 #endif /* defined TM_ZONE */
 	return result;
 }
-- 
2.12.0

