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.

Reply via email to