This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR 5041, zero-length arrays initialized by []; cause gcc-3.0 to segfault

> This fix on mainline when merged to branch fixes things:
> 2001-09-20  DJ Delorie  <>
>         * c-typeck.c (really_start_incremental_init): Discriminate
>         between zero-length arrays and flexible arrays.
>         (push_init_level): Detect zero-length arrays and handle them
>         like fixed-sized arrays.
>         * expr.c (store_constructor): Handle zero-length arrays and
>         flexible arrays correctly.
>         * doc/extend.texi: Update zero-length array notes.
> Index: extend.texi
> ===================================================================
>  GCC versions before 3.0 allowed zero-length arrays to be statically
> -initialized.  In addition to those cases that were useful, it also
> -allowed initializations in situations that would corrupt later data.
> -Non-empty initialization of zero-length arrays is now deprecated.
> +initialized, as if they were flexible arrays.  In addition to those
> +cases that were useful, it also allowed initializations in situations
> +that would corrupt later data.  Non-empty initialization of zero-length
> +arrays is now treated like any case where there are more initializer
> +elements than the array holds, in that a suitable warning about "excess
> +elements in array" is given, and the excess elements (all of them, in
> +this case) are ignored.
>  Instead GCC allows static initialization of flexible array members.
>  This is equivalent to defining a new structure containing the original

I know this isn't your patch, but the paragraph that follows the change 
above doesn't really make sense now.


Instead of what? Maybe the "Instead" should just be removed.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]