From patchwork Sat Dec 27 00:02:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chris Metcalf X-Patchwork-Id: 4439 Received: (qmail 5317 invoked by alias); 27 Dec 2014 00:02:32 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 5129 invoked by uid 89); 27 Dec 2014 00:02:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: emea01-db3-obe.outbound.protection.outlook.com Message-ID: <549DF701.606@ezchip.com> Date: Fri, 26 Dec 2014 19:02:09 -0500 From: Chris Metcalf User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: GLIBC Devel Subject: [PATCH] add some -Werror pragmas for tilegx X-ClientProxiedBy: DM2PR11CA0007.namprd11.prod.outlook.com (25.160.91.17) To DB3PR02MB0537.eurprd02.prod.outlook.com (25.160.51.149) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=cmetcalf@ezchip.com; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:DB3PR02MB0537; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004); SRVR:DB3PR02MB0537; X-Forefront-PRVS: 0438F90F17 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6049001)(377424004)(199003)(189002)(99396003)(19580405001)(107046002)(120916001)(31966008)(68736005)(122386002)(64126003)(66066001)(23676002)(50466002)(21056001)(40100003)(19580395003)(65806001)(83506001)(77096005)(87976001)(229853001)(450100001)(46102003)(47776003)(65956001)(36756003)(50986999)(54356999)(33656002)(107886001)(86362001)(110136001)(106356001)(97736003)(4396001)(65816999)(117156001)(101416001)(64706001)(105586002)(92566001)(77156002)(20776003)(42186005)(62966003)(15975445007)(21314002)(18886065003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR02MB0537; H:[192.168.1.162]; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: ezchip.com does not designate permitted sender hosts) X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:; SRVR:DB3PR02MB0537; X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2014 00:02:24.9331 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR02MB0537 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 +#include #ifdef _LIBC # include @@ -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_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT(4.8, "-Wmaybe-uninitialized"); } else if (br_elem->type == COLL_SYM) { + DIAG_POP_NEEDS_COMMENT; size_t sym_name_len = strlen ((char *) br_elem->opr.name); 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_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT(4.8, "-Wmaybe-uninitialized"); bracket_elem_t start_elem, end_elem; + DIAG_POP_NEEDS_COMMENT; unsigned char start_name_buf[BRACKET_NAME_BUF_SIZE]; unsigned char end_name_buf[BRACKET_NAME_BUF_SIZE]; reg_errcode_t ret;