public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Fix -Os strcoll, wcscoll, build (bug 21313)
@ 2018-02-01 20:38 Joseph Myers
  2018-02-06 18:31 ` Ping " Joseph Myers
  2018-02-07 13:09 ` Adhemerval Zanella
  0 siblings, 2 replies; 3+ messages in thread
From: Joseph Myers @ 2018-02-01 20:38 UTC (permalink / raw)
  To: libc-alpha

The findidx functions used in implementing strcoll / wcscoll already
use DIAG_IGNORE_Os_NEEDS_COMMENT for spurious -Wmaybe-uninitialized
warnings that appear with -Os.  In building with GCC 7 for x86_64 with
-Os, I find there are additional such warnings, for the same structure
elements, which are spurious for the same reasons given in the
existing comments (and this was also reported for MIPS with GCC 5 in
bug 21313).  This patch adds corresponding uses of DIAG_* in the
places that get the additional warnings.

Tested for x86_64 with -Os that this eliminates those warnings and so
allows the build to progress further.

2018-02-01  Joseph Myers  <joseph@codesourcery.com>

	[BZ #21313]
	* locale/weight.h (findidx): Disable -Wmaybe-uninitialized for -Os
	in another place.
	* locale/weightwc.h (findidx): Likewise.

diff --git a/locale/weight.h b/locale/weight.h
index e2fdae1..6028d35 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 682d2b4..ac25ba9 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)
 	    {

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Ping Re: Fix -Os strcoll, wcscoll, build (bug 21313)
  2018-02-01 20:38 Fix -Os strcoll, wcscoll, build (bug 21313) Joseph Myers
@ 2018-02-06 18:31 ` Joseph Myers
  2018-02-07 13:09 ` Adhemerval Zanella
  1 sibling, 0 replies; 3+ messages in thread
From: Joseph Myers @ 2018-02-06 18:31 UTC (permalink / raw)
  To: libc-alpha

Ping.  This patch 
<https://sourceware.org/ml/libc-alpha/2018-02/msg00038.html> is pending 
review.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fix -Os strcoll, wcscoll, build (bug 21313)
  2018-02-01 20:38 Fix -Os strcoll, wcscoll, build (bug 21313) Joseph Myers
  2018-02-06 18:31 ` Ping " Joseph Myers
@ 2018-02-07 13:09 ` Adhemerval Zanella
  1 sibling, 0 replies; 3+ messages in thread
From: Adhemerval Zanella @ 2018-02-07 13:09 UTC (permalink / raw)
  To: libc-alpha



On 01/02/2018 18:38, Joseph Myers wrote:
> The findidx functions used in implementing strcoll / wcscoll already
> use DIAG_IGNORE_Os_NEEDS_COMMENT for spurious -Wmaybe-uninitialized
> warnings that appear with -Os.  In building with GCC 7 for x86_64 with
> -Os, I find there are additional such warnings, for the same structure
> elements, which are spurious for the same reasons given in the
> existing comments (and this was also reported for MIPS with GCC 5 in
> bug 21313).  This patch adds corresponding uses of DIAG_* in the
> places that get the additional warnings.
> 
> Tested for x86_64 with -Os that this eliminates those warnings and so
> allows the build to progress further.
> 
> 2018-02-01  Joseph Myers  <joseph@codesourcery.com>
> 
> 	[BZ #21313]
> 	* locale/weight.h (findidx): Disable -Wmaybe-uninitialized for -Os
> 	in another place.
> 	* locale/weightwc.h (findidx): Likewise.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> 
> diff --git a/locale/weight.h b/locale/weight.h
> index e2fdae1..6028d35 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 682d2b4..ac25ba9 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)
>  	    {
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-07 12:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01 20:38 Fix -Os strcoll, wcscoll, build (bug 21313) Joseph Myers
2018-02-06 18:31 ` Ping " Joseph Myers
2018-02-07 13:09 ` Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).