This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: aliasing between const and non-const objects
- From: Michael Matz <matz at suse dot de>
- To: Richard dot Earnshaw at arm dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 29 Jul 2003 18:15:20 +0200 (CEST)
- Subject: Re: aliasing between const and non-const objects
Hi,
On Tue, 29 Jul 2003, Richard Earnshaw wrote:
> Incorrect. External code could quite legitimately be:
Hmm, right. I'm obviously blind and barking up the wrong tree :-|
> foo()
> {
> int a[5];
>
> t = a; c = a;
You'll get a warning for the latter assignment, though. Nevethess you are
right. I should have provided a more complete example:
int *t;
const int data[3] = {0, 1, 2};
const int *c;
bla() {
c = data;
t[0] = c[0] + c[1] + c[2];
t[1] = c[0] + c[1] + c[2];
}
Ok, that seems more an issue for memrefs_conflict_p() and friends.
Ciao,
Michael.