On 2 Jan 2015, at 05:00, Ed Maste <ema...@freebsd.org> wrote:
> It's a variable length array in a struct / union. Other than being
> confusing and now triggering a warning after the clang update it
> should be fine.
> Most likely we need to build asr with -Werror disabled for that
> warning, perhaps -Wno-error-array-bounds. I'll take a look tomorrow
> morning if nobody else gets to it first.

The correct solution is to declare the array to have 0 elements (although this 
will break C++ code).  A zero-length array at the end of a structure is 
specifically defined by the C standard (since C99) to be a variable-length 
array.  A length-one array was used in C89 prior to this for this purpose.  
Using a 1-element array in C is undefined behaviour.

Note that this change will also require fixing code that allocates it to 
allocate space for n elements not n-1.


freebsd-current@freebsd.org mailing list
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to