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: should MEM tracking be able to optimize this?


On Sun, Nov 18, 2001 at 12:30:11PM -0200, Alexandre Oliva wrote:
> On Nov 18, 2001, kenner@vlsi1.ultra.nyu.edu (Richard Kenner) wrote:
> 
> > 	struct foo { float a[2048], b[2048]; }
> 
> > It's obvious statically that X.a[i] and Y.b[j] can never conflict for any
> > expressions X and Y of type struct foo.  But there needs to be a way to
> > represent this.
> 
> Err...  Isn't it valid to assume that &X.a[2048] == &X.b[0], which
> would be the reason why both fields must be in the same alias set?

No.  &X.a[2048] is a legitimate pointer for purpose of comparing it
with another pointer *into the same array* (X.a) but dereferencing it,
or comparing it to a pointer into a different array (such as X.b) is
undefined behavior.

zw


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