This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] add some -Werror pragmas for tilegx

We see some crazy warnings on tilegx with gcc 4.8.2:

In file included from regex.c:66:0:
regcomp.c: In function âparse_expressionâ:
regcomp.c:2849:15: error: âend_elemâ may be used uninitialized in this
function [-Werror=maybe-uninitialized]
       else if (br_elem->type == COLL_SYM)
regcomp.c:3109:34: note: âend_elemâ was declared here
       bracket_elem_t start_elem, end_elem;
regcomp.c:3109:22: error: âstart_elemâ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
       bracket_elem_t start_elem, end_elem;

These warnings are not seen on x86, and in fact if I compile the
preprocessed tile sources with the x86 gcc 4.8.2, I don't see the
warnings.  I do see equivalent warnings if I compile the
x86-preprocessed source code with tilegx gcc 4.8.2.

The change seems to be the minimally scoped thing necessary to avoid
the warnings on tilegx, but it is somewhat ugly.  Any suggestions as
to other ways to avoid this issue?

2014-12-26  Chris Metcalf  <>

        * posix/regcomp.c (parse_bracket_exp): Add DIAG_xxx macros to
        suppress two uninitialized variable warnings on tilegx gcc 4.8.2.

diff --git a/posix/regcomp.c b/posix/regcomp.c
index 897fe276a3fa..8ec8126888e3 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -18,6 +18,7 @@
    <>.  */

 #include <stdint.h>
+#include <libc-internal.h>

 #ifdef _LIBC
 # include <locale/weight.h>
@@ -2845,9 +2846,16 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
          if (nrules != 0)
            return __collseq_table_lookup (collseqwc, br_elem->opr.wch);
+          /* Using the tilegx gcc 4.8.2 yields uninitialized warnings
+             here (on the "else if" line) and below.  Compiling the same
+             source code with the same gcc version on x86_64 does not
+             yield the warning, so it is something subtle.  */
+          DIAG_IGNORE_NEEDS_COMMENT(4.8, "-Wmaybe-uninitialized");
       else if (br_elem->type == COLL_SYM)
          size_t sym_name_len = strlen ((char *) br_elem->;
          if (nrules != 0)
@@ -3106,7 +3114,11 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,

   while (1)
+      /* See above for tilegx 4.8.2 warnings generated in this file.  */
+      DIAG_IGNORE_NEEDS_COMMENT(4.8, "-Wmaybe-uninitialized");
       bracket_elem_t start_elem, end_elem;
       unsigned char start_name_buf[BRACKET_NAME_BUF_SIZE];
       unsigned char end_name_buf[BRACKET_NAME_BUF_SIZE];
       reg_errcode_t ret;

Chris Metcalf, EZChip Semiconductor

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]