From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18444 invoked by alias); 15 Oct 2010 01:01:24 -0000 Received: (qmail 18435 invoked by uid 22791); 15 Oct 2010 01:01:23 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,MISSING_MID X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 15 Oct 2010 01:01:17 +0000 From: "joseph at codesourcery dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/46028] Regression from GCC 4.4: "storage size of 'test_array' isn't constant" X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: joseph at codesourcery dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Fri, 15 Oct 2010 01:01:00 -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 X-SW-Source: 2010-10/txt/msg01253.txt.bz2 Message-ID: <20101015010100.ToZcR5fjUHY4WVGw0EqeHUZbdmnd3owf0k3bvhq_vk4@z> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46028 --- Comment #3 from joseph at codesourcery dot com 2010-10-15 01:01:13 UTC --- Note that you can't trivially extend the laxity in /* Handle a size folded to an integer constant but not an integer constant expression. */ if (!size_int_const) { /* If this is a file scope declaration of an ordinary identifier, this is invalid code; diagnosing it here and not subsequently treating the type as variable-length avoids more confusing diagnostics later. */ if ((decl_context == NORMAL || decl_context == FIELD) && current_scope == file_scope) pedwarn (input_location, 0, "variably modified %qE at file scope", name); else this_size_varies = size_varies = true; warn_variable_length_array (name, size); } (that does a pedwarn rather than an error if this occurs at file scope) to the present case of a static array inside a function, because it's valid to have a block scope static *pointer* to VLA (which is however different from a pointer to non-VLA), so you'd need to be lax only if it's a static array rather than a pointer to such.