> On Jul 16, 2025, at 17:47, Jakub Jelinek <ja...@redhat.com> wrote:
> 
> On Wed, Jul 16, 2025 at 09:22:19PM +0000, Qing Zhao wrote:
>> Yes, the above solution could  also resolve the undefined behavior issue. We 
>> can certainly go
>> with this approach.
> 
> Another option is to use .ACCESS_WITH_SIZE (with different flags compared to
> the FAM cases) solely on reads from the pointer, and then objsz pass taking
> the indirection into account.

A little confused here, For this option, do you mean the first argument will be 
the ADDRESS of the pointer?

>  I.e. when you see some pointer dereferenced
> and the pointer originates in .ACCESS_WITH_SIZE with that flag, take it as
> size of what the pointer points at rather than the FAM way.
Yes, this is what I did in the 7th and  8th version of the patch. 

>  Still,
> .ACCESS_WITH_SIZE first argument should be the pointer value, not its
> address,

What’s the major issue with passing the address of the pointer value to 
.ACCESS_WITH_SIZE?

> and you should never instrument stores to the pointer, only reads
> from it.

>  So, f->p = whatever; doesn't get .ACCESS_WITH_SIZE,
> _1 = f->p; gets it and then f->p[a] is

Still my question:
How to decide  it’s a store or a read when we see f->p in C parser?
Is there any good example in C FE I can refer?

Thanks a lot.

Qing
> _2 = _1 p+ off;
> MEM_REF[_2]
> opr similar.
> 
> Jakub
> 

Reply via email to