unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org
Subject: Re: Fix two more -Os strcoll / wcscoll build failures
Date: Tue, 27 Feb 2018 10:34:36 -0300	[thread overview]
Message-ID: <c55a36e6-8821-cfd9-c9ee-2da0921922bd@linaro.org> (raw)
In-Reply-To: <alpine.DEB.2.20.1802262152320.2986@digraph.polyomino.org.uk>



On 26/02/2018 18:53, Joseph Myers wrote:
> Continuing fixes for -Os build issues shown with build-many-glibcs.py,
> this patch adds uses of DIAG_* to disable -Wmaybe-uninitialized in two
> more places where code inlined from strcoll / wcscoll is wrongly
> diagnosed as possibly using uninitialized structure fields.  (All
> these warnings in different places for these functions are I think
> essentially the same bug.)
> 
> Tested with build-many-glibcs.py for alpha-linux-gnu and
> mips-linux-gnu that this fixes the -Os build failures for those
> configurations with GCC 7.
> 
> 2018-02-26  Joseph Myers  <joseph@codesourcery.com>
> 
> 	* locale/weightwc.h (findidx): Ignore -Wmaybe-uninitialized for
> 	-Os in two more places.

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

> 
> diff --git a/locale/weightwc.h b/locale/weightwc.h
> index ac25ba9..36c65b5 100644
> --- a/locale/weightwc.h
> +++ b/locale/weightwc.h
> @@ -28,7 +28,15 @@ findidx (const int32_t *table,
>  	 const wint_t *extra,
>  	 const wint_t **cpp, size_t len)
>  {
> +  /* With GCC 7 when compiling with -Os the compiler warns that
> +     seq1.back_us and seq2.back_us, which become *cpp, might be used
> +     uninitialized.  This is impossible as this function cannot be
> +     called except in cases where those fields have been
> +     initialized.  */
> +  DIAG_PUSH_NEEDS_COMMENT;
> +  DIAG_IGNORE_Os_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
>    wint_t ch = *(*cpp)++;
> +  DIAG_POP_NEEDS_COMMENT;
>    int32_t i = __collidx_table_lookup ((const char *) table, ch);
>  
>    if (i >= 0)
> @@ -107,11 +115,18 @@ findidx (const int32_t *table,
>  	      continue;
>  	    }
>  
> +	  /* 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");
>  	  if (cp[nhere - 1] > usrc[nhere -1])
>  	    {
>  	      cp += 2 * nhere;
>  	      continue;
>  	    }
> +	  DIAG_POP_NEEDS_COMMENT;
>  
>  	  if (cp[2 * nhere - 1] < usrc[nhere -1])
>  	    {
> 


      reply	other threads:[~2018-02-27 13:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26 21:53 Fix two more -Os strcoll / wcscoll build failures Joseph Myers
2018-02-27 13:34 ` Adhemerval Zanella [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c55a36e6-8821-cfd9-c9ee-2da0921922bd@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).