> On Jun 12, 2025, at 14:32, Joseph Myers <josmy...@redhat.com> wrote:
> 
> On Thu, 12 Jun 2025, Qing Zhao wrote:
> 
>>> In general I think we'd only expect an error if the information required 
>>> to give it is visible at the point where the counted_by attribute is used.  
>>> There might be a possibility of giving an error for this case when the 
>>> pointer gets dereferenced (and thus the counted_by information gets 
>>> implicitly used).
>> 
>> Okay, I see. 
>> I think that the right place to check and issue error for this is:
>> 
>> When generating the call to .ACCESS_WITH_SIZE for a component_ref with 
>> counted_by attribute, if the pointee’s TYPE is still incomplete at this 
>> moment, C FE issues error at this time. And the call to 
>> .ACCESS_WITH_SIZE will not be generated.
> 
> If the type is actually incomplete, the dereference itself will give an 
> error, independent of counted_by.

Okay. 
> 
> If the type has a flexible array member, then, yes, that would be an 
> appropriate point to generate an error.

Thanks, I will generate an error for such cases.

Qing
> 
> -- 
> Joseph S. Myers
> josmy...@redhat.com


Reply via email to