about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--locale/weight.h8
-rw-r--r--locale/weightwc.h7
3 files changed, 22 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d823e3ac3b..7ff1ffb2ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2018-02-07  Joseph Myers  <joseph@codesourcery.com>
+
+	[BZ #21313]
+	* locale/weight.h (findidx): Disable -Wmaybe-uninitialized for -Os
+	in another place.
+	* locale/weightwc.h (findidx): Likewise.
+
 2018-02-07  Wilco Dijkstra  <wdijkstr@arm.com>
 
 	* manual/probes.texi (slowlog): Delete documentation of removed probe.
diff --git a/locale/weight.h b/locale/weight.h
index e2fdae1713..6028d3595e 100644
--- a/locale/weight.h
+++ b/locale/weight.h
@@ -132,7 +132,15 @@ findidx (const int32_t *table,
 	      do
 		{
 		  offset <<= 8;
+		  /* With GCC 7 when compiling with -Os the compiler
+		     warns that seq1.back_us and seq2.back_us, which
+		     become usrc, might be used uninitialized.  This
+		     is impossible for the same reason as described
+		     above.  */
+		  DIAG_PUSH_NEEDS_COMMENT;
+		  DIAG_IGNORE_Os_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
 		  offset += usrc[cnt] - cp[cnt];
+		  DIAG_POP_NEEDS_COMMENT;
 		}
 	      while (++cnt < nhere);
 	    }
diff --git a/locale/weightwc.h b/locale/weightwc.h
index 682d2b4eaf..ac25ba95b9 100644
--- a/locale/weightwc.h
+++ b/locale/weightwc.h
@@ -90,9 +90,16 @@ findidx (const int32_t *table,
 	  size_t cnt;
 	  size_t offset;
 
+	  /* With GCC 7 when compiling with -Os the compiler warns
+	     that seq1.back_us and seq2.back_us, which become usrc,
+	     might be used uninitialized.  This is impossible for the
+	     same reason as described above.  */
+	  DIAG_PUSH_NEEDS_COMMENT;
+	  DIAG_IGNORE_Os_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
 	  for (cnt = 0; cnt < nhere - 1 && cnt < len; ++cnt)
 	    if (cp[cnt] != usrc[cnt])
 	      break;
+	  DIAG_POP_NEEDS_COMMENT;
 
 	  if (cnt < nhere - 1)
 	    {