public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] posix: Suppress -Os may be used uninitialized warnings on regexec
Date: Wed,  5 Oct 2022 21:43:39 +0000 (GMT)	[thread overview]
Message-ID: <20221005214339.BEBC33857416@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=442e3a21724b07b3ae1c3c5eeba4a8e44a1a50a3

commit 442e3a21724b07b3ae1c3c5eeba4a8e44a1a50a3
Author: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Date:   Wed Sep 21 10:51:05 2022 -0300

    posix: Suppress -Os may be used uninitialized warnings on regexec
    
    GCC with -Os issues may uninitialized warnings on regexec code.
    
    Checked on x86_64-linux-gnu and i686-linux-gnu.
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
    Tested-by: Carlos O'Donell <carlos@redhat.com>

Diff:
---
 posix/regexec.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/posix/regexec.c b/posix/regexec.c
index cffeaf2845..386a757f35 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -3768,7 +3768,13 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
 	      _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
 	  for (i = 0; i < cset->ncoll_syms; ++i)
 	    {
+	      /* The compiler might warn that extra may be used uninitialized,
+		 however the loop will be executed iff ncoll_syms is larger
+		 than 0,which means extra will be already initialized.  */
+	      DIAG_PUSH_NEEDS_COMMENT;
+	      DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
 	      const unsigned char *coll_sym = extra + cset->coll_syms[i];
+	      DIAG_POP_NEEDS_COMMENT;
 	      /* Compare the length of input collating element and
 		 the length of current collating element.  */
 	      if (*coll_sym != elem_len)

                 reply	other threads:[~2022-10-05 21:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

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

  git send-email \
    --in-reply-to=20221005214339.BEBC33857416@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@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).