From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9331 invoked by alias); 10 Dec 2006 17:18:08 -0000 Received: (qmail 9286 invoked by uid 48); 10 Dec 2006 17:17:56 -0000 Date: Sun, 10 Dec 2006 17:18:00 -0000 Message-ID: <20061210171756.9285.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c/19977] overflow in non-static initializer should not be pedwarn In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "manu at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-12/txt/msg00863.txt.bz2 ------- Comment #3 from manu at gcc dot gnu dot org 2006-12-10 17:17 ------- This patch seems to fix this. I get: XPASS: gcc.dg/overflow-warn-3.c constant (test for bogus messages, line 42) XPASS: gcc.dg/overflow-warn-4.c constant (test for bogus messages, line 42) and no new failures on the overflow testcases. I still have to properly bootstrap and regression test it. Any thoughts? Index: gcc/c-typeck.c =================================================================== --- gcc/c-typeck.c (revision 119686) +++ gcc/c-typeck.c (working copy) @@ -4358,7 +4360,7 @@ store_init_value (tree decl, tree init) /* ANSI wants warnings about out-of-range constant initializers. */ STRIP_TYPE_NOPS (value); - constant_expression_warning (value); + if (TREE_STATIC (decl)) constant_expression_warning (value); /* Check if we need to set array size from compound literal size. */ if (TREE_CODE (type) == ARRAY_TYPE -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19977