On 2025-07-23 11:08, Qing Zhao wrote:
We always generate a call to .ACCESS_WITH_SIZE for every f->p whatever it’s a 
reference
or a definition in C FE parser. (This is the case for FAM)

Hmm, that's not correct then and I have been misreading the code all this while; .ACCESS_WITH_SIZE does not make sense for a definition because the size in question may or may not even be correct w.r.t. the definition at the point that it is emitted. I reckon this too does not come up in the FAM case because the FAM is not allocated separately from its containing object, whereas in the case of a pointer, it is allocated separately. So...

For pointer with counted by,  Yes, if we can determine whether a f->p is an 
object reference or
an object definition, and ONLY emitting .ACCESS_WITH_SIZE for the f->p when 
it’s a object reference,
then the approach that passes the VALUE of f->p to .ACCESS_WITH_SIZE is safe.

However, I have two questions for this:

Question 1: Can we make sure this in C FE?  (Determine whether a f->p is an 
object reference of an object definition)

... it probably makes sense to focus on resolving this question to make sure that .ACCESS_WITH_SIZE is generated for a reference only when the reference is a read and not when it's a write because that's the only place where the call actually has a correct meaning.

Sid

Reply via email to