On Thu, Mar 13 2025, Richard Biener wrote:
> On Mon, Mar 10, 2025 at 11:59 PM Martin Jambor <mjam...@suse.cz> wrote:
>>
>> Hi,
>>
>> when reading the function ao_compare::compare_ao_refs I came accross
>> what I believe to ba a copy-and-paste error which this patch fixes.
>>
>> Bootstrapped, LTO-bootstrapped and tested on x86_64-linux.  OK for
>> master?
>
> OK.  I'll note this must have previously disallowed almost everything?

Thanks.  The previous code improperly handled accesses where some of the
handled_components were ends_tbaa_access_path_p.  Those that had it were
always disallowed even when they shouldn't but, perhaps more
importantly, if the first access didn't have it and the second one did,
they were allowed even though they should have not been - though I think
constructing a testcase given all the other conditions in the function
would be very very difficult.

Still, I actually plan to backport this after a few weeks.

Martin


>
> Thanks,
> Richard.
>
>> Thanks,
>>
>> Martin
>>
>>
>> gcc/ChangeLog:
>>
>> 2025-03-10  Martin Jambor  <mjam...@suse.cz>
>>
>>         * tree-ssa-alias.cc (ao_compare::compare_ao_refs): Fix a
>>         copy-and-paste error.
>> ---
>>  gcc/tree-ssa-alias.cc | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/gcc/tree-ssa-alias.cc b/gcc/tree-ssa-alias.cc
>> index 2489aa6b808..e93d5187d50 100644
>> --- a/gcc/tree-ssa-alias.cc
>> +++ b/gcc/tree-ssa-alias.cc
>> @@ -4355,12 +4355,13 @@ ao_compare::compare_ao_refs (ao_ref *ref1, ao_ref 
>> *ref2,
>>         c1 = p1, nskipped1 = i;
>>        i++;
>>      }
>> +  i = 0;
>>    for (tree p2 = ref2->ref; handled_component_p (p2); p2 = TREE_OPERAND 
>> (p2, 0))
>>      {
>>        if (component_ref_to_zero_sized_trailing_array_p (p2))
>>         end_struct_ref2 = p2;
>>        if (ends_tbaa_access_path_p (p2))
>> -       c2 = p2, nskipped1 = i;
>> +       c2 = p2, nskipped2 = i;
>>        i++;
>>      }
>>
>> --
>> 2.47.1
>>

Reply via email to