This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Aliasing of arrays


On Wed, Nov 30, 2016 at 6:29 PM, Joseph Myers <joseph@codesourcery.com> wrote:
> On Wed, 30 Nov 2016, Richard Biener wrote:
>
>> but that probably shouldn't apply to array types.  The idea is that
>> objects of the same type cannot overlap.  Maybe Joseph can clarify whether
>> and array object of known size really constitutes an object in that sense.
>
> This is one of the ambiguous cases about which objects are relevant for
> type-based aliasing rules.  I think it's best not to optimize this (that
> is, to treat the objects as being the individual array elements, so the
> arrays can overlap by an exact multiple of the element size - meaning the
> ultimate element size in the case of multidimensional arrays, so e.g. two
> int[4][5] arrays could be offset by one int from each other).

Ok, and I agree.

Testing the attached patch.

Richard.

2016-12-01  Richard Biener  <rguenther@suse.de>

        * tree-ssa-alias.c (indirect_refs_may_alias_p): Do not
        treat arrays with same type as objects that cannot overlap.

        * gcc.dg/torture/alias-2.c: New testcase.

Attachment: p3
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]