> On Jun 18, 2025, at 17:26, Joseph Myers <josmy...@redhat.com> wrote:
>
> On Mon, 16 Jun 2025, Qing Zhao wrote:
>
>> Current array bound checker only instruments ARRAY_REF, and the INDEX
>> information is the 2nd operand of the ARRAY_REF.
>>
>> When extending the array bound checker to pointer references with
>> counted_by attributes, the hardest part is to get the INDEX of the
>> corresponding array ref from the offset computation expression of
>> the pointer ref. I.e.
>>
>> Given an OFFSET expression, and the ELEMENT_SIZE,
>> get the index expression from the OFFSET.
>> For example:
>> OFFSET:
>> ((long unsigned int) m * (long unsigned int) SAVE_EXPR <n>) * 4
>> ELEMENT_SIZE:
>> (sizetype) SAVE_EXPR <n> * 4
>> get the index as (long unsigned int) m.
>
> This patch is OK once the rest of the series is approved, in the absence
> of objections within 48 hours.
Thanks a lot for the review.
Qing
>
> --
> Joseph S. Myers
> josmy...@redhat.com