This is the mail archive of the
mailing list for the GCC project.
Re: PR 5041, zero-length arrays initialized by ; cause gcc-3.0 to segfault
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Craig Rodrigues <rodrigc at mediaone dot net>
- Cc: gcc-patches at gcc dot gnu dot org, Richard dot Earnshaw at arm dot com
- Date: Fri, 07 Dec 2001 16:05:30 +0000
- Subject: Re: PR 5041, zero-length arrays initialized by ; cause gcc-3.0 to segfault
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
> This fix on mainline when merged to branch fixes things:
> 2001-09-20 DJ Delorie <email@example.com>
> * 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.