public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "joseph at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/46028] Regression from GCC 4.4: "storage size of 'test_array' isn't constant"
Date: Fri, 15 Oct 2010 01:01:00 -0000	[thread overview]
Message-ID: <20101015010100.ToZcR5fjUHY4WVGw0EqeHUZbdmnd3owf0k3bvhq_vk4@z> (raw)
In-Reply-To: <bug-46028-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46028

--- Comment #3 from joseph at codesourcery dot com <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.


  parent reply	other threads:[~2010-10-15  1:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-14 23:20 [Bug c/46028] New: " marti at juffo dot org
2010-10-14 23:22 ` [Bug c/46028] " pinskia at gcc dot gnu.org
2010-10-14 23:23 ` pinskia at gcc dot gnu.org
2010-10-15  1:01 ` joseph at codesourcery dot com [this message]
2011-03-14 10:37 ` philipp at marek dot priv.at

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101015010100.ToZcR5fjUHY4WVGw0EqeHUZbdmnd3owf0k3bvhq_vk4@z \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).