Re: Aliasing of arrays

2016-12-01 Thread Richard Biener
On Wed, Nov 30, 2016 at 6:29 PM, Joseph Myers 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 constitu

Re: Aliasing of arrays

2016-11-30 Thread Joseph Myers
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 c

Re: Aliasing of arrays

2016-11-30 Thread Richard Biener
On Wed, Nov 30, 2016 at 2:19 PM, Alexander Cherepanov wrote: > Hi! > > Pascal Cuoq communicated to me the following example: > > int ar1(int (*p)[3], int (*q)[3]) > { > (*p)[0] = 1; > (*q)[1] = 2; > return (*p)[0]; > } > > gcc of versions 4.9.2 and 7.0.0 20161129 optimize it with -O2 on the

Aliasing of arrays

2016-11-30 Thread Alexander Cherepanov
Hi! Pascal Cuoq communicated to me the following example: int ar1(int (*p)[3], int (*q)[3]) { (*p)[0] = 1; (*q)[1] = 2; return (*p)[0]; } gcc of versions 4.9.2 and 7.0.0 20161129 optimize it with -O2 on the premise that elements with different indices don't alias: :