This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: malloc attributes and realloc
On Thu, 2 Jan 2004, Gabriel Dos Reis wrote:
> Not really. As Joseph pointed out earlier, if you save the pointer
> value in an array of unsigned char and latter do bits compare, you can
> safely determine whether realloc returns the same pointer or not.
>
> I don't know how that affect the design of the aliasing algorithm in
> the compiler though.
Probably the fact that this involves taking the address of copies of the
pointer should inhibit alias analysis about where those pointer objects
might point to. If not, it ought to (a pointer can become based on
another one through bitwise examination and comparison, not just through
direct copies) though the exact rules may depend on the resolution of the
referenced DR. In any case this is not realloc specific (the same
problems with bit-representations can arise with freed pointers and
malloc, etc.).
--
Joseph S. Myers
jsm@polyomino.org.uk