PR 58958: wrong aliasing info
Marc Glisse
marc.glisse@inria.fr
Mon Nov 4 11:13:00 GMT 2013
On Mon, 4 Nov 2013, Richard Biener wrote:
> On Fri, Nov 1, 2013 at 11:39 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
>> Hello,
>>
>> the issue was described in the PR and the message linked from there.
>> ao_ref_init_from_ptr_and_size calls get_ref_base_and_extent, which may
>> detect an array_ref of variable index, but ao_ref_init_from_ptr_and_size
>> never learns of it and uses the offset+size as if they were meaningful.
>
> Well... it certainly learns of it, but it chooses to ignore...
>
> if (TREE_CODE (ptr) == ADDR_EXPR)
> - ref->base = get_ref_base_and_extent (TREE_OPERAND (ptr, 0),
> - &ref->offset, &t1, &t2);
> + {
> + ref->base = get_addr_base_and_unit_offset_1 (TREE_OPERAND (ptr, 0),
> + &t, 0, &safe);
> + ref->offset = BITS_PER_UNIT * t;
> + }
>
> safe == (t1 != -1 && t1 == t2)
I'll try that... (I need to think whether that's sufficient to be safe)
> note that ao_ref_init_from_ptr_and_size gets the size fed in as argument
> so I fail to see why it matters at all ...? That is, if you feed in a wrong
> size then it's the callers error.
The caller is feeding the right size. The issue is that
get_ref_base_and_extent cannot determine the offset as a constant.
Normally, get_ref_base_and_extent then gives you a safe combination of
offset+maxsize to cover the whole decl. Here, we don't want to use the
size determined by get_ref_base_and_extent, we know better, but that also
means we have to handle the case where the offset couldn't be determined
as a constant.
--
Marc Glisse
More information about the Gcc-patches
mailing list