This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: malloc attributes and realloc
- From: Jeff Sturm <jsturm at one-point dot com>
- To: Daniel Berlin <dberlin at dberlin dot org>
- Cc: gcc at gcc dot gnu dot org, "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- Date: Thu, 1 Jan 2004 16:52:12 -0500 (EST)
- Subject: Re: malloc attributes and realloc
On Thu, 1 Jan 2004, Daniel Berlin wrote:
> >> /* Reallocate memory without fail. This works like xmalloc. Note,
> >> realloc type functions are not suitable for attribute malloc since
> >> they may return the same address across multiple calls. */
> >
> > This comment is misleading. The pointer address returned by a
> > malloc-type
> > function isn't significant to alias analysis.
>
> This isn't true.
Sorry, my thinking was garbled. Serves me right for posting early on New
Year's Day.
Nevertheless, the comment isn't quite right, isn't it? I was thinking of
the example "p1=malloc(n);free(p1);p2=malloc(n)" in which p1 == p2 is
possible even though they do not alias.
Jeff