about summary refs log tree commit diff
path: root/posix/regexec.c
diff options
context:
space:
mode:
authorAdhemerval Zanella Netto <adhemerval.zanella@linaro.org>2022-09-21 10:51:05 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-10-05 18:04:13 -0300
commit442e3a21724b07b3ae1c3c5eeba4a8e44a1a50a3 (patch)
tree68bc49e38807dfaa2d93e07ec710c834323a2cdd /posix/regexec.c
parent9ec1c8cd243e9d7d63e188620a7e70a3b69777e6 (diff)
downloadglibc-442e3a21724b07b3ae1c3c5eeba4a8e44a1a50a3.tar.gz
glibc-442e3a21724b07b3ae1c3c5eeba4a8e44a1a50a3.tar.xz
glibc-442e3a21724b07b3ae1c3c5eeba4a8e44a1a50a3.zip
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>
Diffstat (limited to 'posix/regexec.c')
-rw-r--r--posix/regexec.c6
1 files changed, 6 insertions, 0 deletions
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)