From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79542 invoked by alias); 9 May 2015 12:20:04 -0000 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 Received: (qmail 79450 invoked by uid 48); 9 May 2015 12:20:00 -0000 From: "kugan at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/66066] [6 Regression] r222889 causes bogus error: initializer element is not constant Date: Sat, 09 May 2015 12:20:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kugan at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 6.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-05/txt/msg00754.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66066 kugan at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kugan at gcc dot gnu.org --- Comment #5 from kugan at gcc dot gnu.org --- I ran into this today when I created a cross compiler for aarch64-linux-gnu. It also happens with arm. As Richard Biener suggested, -pedantic helps. How about this: diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 3fcb7c2..d5d82fd 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -10702,7 +10702,7 @@ build_binary_op (location_t location, enum tree_code code, { /* Don't reject a left shift of a negative value in a context where a constant expression is needed in C90. */ - if (flag_isoc99) + if (flag_isoc99 && pedantic) int_const = false; if (c_inhibit_evaluation_warnings == 0) warning_at (location, OPT_Wshift_negative_value,