https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896

--- Comment #25 from qinzhao at gcc dot gnu.org ---
(In reply to Martin Uecker from comment #17)
> The syntax with the dot would make it not conflict.  But I need
> this for this use case
> 
> struct foo {
>   int count;
>   int (*buf)[.count];
> };
> 
> so that ARRAY_SIZE(*foo->buf) works correctly and also accesses
> to foo->buf are bounds checkked.  So it would make sense to 
> solve to treat flexible array members in the same way.
Yes, I agree. 

then the size of the array type (even though it's not a constant) will be
embedded in the TYPE consistently. therefore simplify compiler's implementation
and make it consistently. 

> 
> But I agree that we should simply add the attribute now also
> because it makes it possible to use it for existing code bases.
Yes.

Reply via email to