Type based alias analysis

Chris G. Demetriou cgd@netbsd.org
Wed Jun 30 15:43:00 GMT 1999


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.



More information about the Gcc mailing list