about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--string/strcoll_l.c11
2 files changed, 15 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f7e7204c4f..a556c3bf7a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2018-02-26  Joseph Myers  <joseph@codesourcery.com>
 
+	* string/strcoll_l.c: Include <libc-diag.h>.
+	(STRCOLL): Ignore -Wmaybe-uninitialized for -Os around
+	declarations of seq1 and seq2.
+
 	[BZ #15105]
 	* stdlib/atoi.c (atoi): Use libc_hidden_def.
 	* include/stdlib.h [!_ISOMAC] (atoi): Use libc_hidden_proto.
diff --git a/string/strcoll_l.c b/string/strcoll_l.c
index 4a63c56bf2..c001ff4ad4 100644
--- a/string/strcoll_l.c
+++ b/string/strcoll_l.c
@@ -24,6 +24,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <sys/param.h>
+#include <libc-diag.h>
 
 #ifndef STRING_TYPE
 # define STRING_TYPE char
@@ -291,7 +292,17 @@ STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, locale_t l)
 
   int result = 0, rule = 0;
 
+  /* With GCC 7 when compiling with -Os the compiler warns that
+     seq1.back_us and seq2.back_us might be used uninitialized.
+     Sometimes this warning appears at locations in locale/weightwc.h
+     where the actual use is, but on architectures other than x86_64,
+     x86 and s390x, a warning appears at the definitions of seq1 and
+     seq2.  This uninitialized use is impossible for the same reason
+     as described in comments in locale/weightwc.h.  */
+  DIAG_PUSH_NEEDS_COMMENT;
+  DIAG_IGNORE_Os_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
   coll_seq seq1, seq2;
+  DIAG_POP_NEEDS_COMMENT;
   seq1.len = 0;
   seq1.idxmax = 0;
   seq1.rule = 0;