This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RTL alias analysis
- From: Ian Lance Taylor <ian at airs dot com>
- To: "Dave Korn" <dave dot korn at artimi dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: 21 Jan 2006 17:35:57 -0800
- Subject: Re: RTL alias analysis
- References: <SERRANOcbKTrRVXR08i00000262@SERRANO.CAM.ARTIMI.COM>
"Dave Korn" <dave.korn@artimi.com> writes:
> I think he's saying that _this_ one might generate invalid code:
>
> void test(void)
> {
> union { int i; double d; } u;
> int *ip;
> double *dp;
> int ii;
> double dd;
>
> dp = &u.d;
> ip = &u.i;
> *ip = 15;
> ii = *ip;
> *dp = 1.5;
> dd = *dp;
> printf("ii=%d dd=%f\n", ii, dd);
> }
That function is valid too.
Here is an example of an invalid function:
void test(void)
{
union { int i; double d; } u;
int *ip;
double *dp;
int ii;
double dd;
dp = &u.d;
ip = &u.i;
*ip = 15;
*dp = 1.5;
ii = *ip;
dd = *dp;
printf("ii=%d dd=%f\n", ii, dd);
}
Ian