This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Type based alias analysis
- To: John Milford <jwm at CSUA dot Berkeley dot EDU>
- Subject: Re: Type based alias analysis
- From: cgd at netbsd dot org (Chris G. Demetriou)
- Date: 13 Jun 1999 18:14:35 -0700
- Cc: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>, egcs at egcs dot cygnus dot com
- References: <199906140101.SAA24073@soda.CSUA.Berkeley.EDU>
John Milford <jwm@CSUA.Berkeley.EDU> writes:
> [ ... ] nso the compiler would turn this into something
> equivalent to:
>
> int foo(int *ip, float *fp) {
> assert(ip != fp);
> *ip = 10;
> *fp = 3.4;
> return(*ip);
> }
>
> Basically, ever time the compiler makes the assumption that
> two pointers don't alias the same memory it would insert a check
> that would verify the assumption is correct at runtime.
Of course, that's not really the extent of the assumption made by the
compiler, right?
A proper check would have to be something like "assert(nooverlap(ip,
fp))", where nooverlap verifies that the memory regions:
[ (char *)ip .. (char *)ip + sizeof *ip )
[ (char *)fp .. (char *)fp + sizeof *fp )
do not overlap.
cgd
--
Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.