]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
posix: Suppress -Os may be used uninitialized warnings on regexec
authorAdhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Wed, 21 Sep 2022 13:51:05 +0000 (10:51 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 5 Oct 2022 21:04:13 +0000 (18:04 -0300)
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>
posix/regexec.c

index cffeaf28451878873d10e1156dde79121ea88a9c..386a757f356530e84b8b3cdd5384b73c19fe4062 100644 (file)
@@ -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)