This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: malloc attributes and realloc
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Robert Dewar <dewar at gnat dot com>
- Cc: Jeff Sturm <jsturm at one-point dot com>, Daniel Berlin <dberlin at dberlin dot org>, gcc at gcc dot gnu dot org, "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- Date: 02 Jan 2004 00:33:35 +0100
- Subject: Re: malloc attributes and realloc
- Organization: Integrable Solutions
- References: <Pine.LNX.4.44.0401011643450.25158-100000@ops2.one-point.com><3FF40055.5010004@gnat.com>
Robert Dewar <dewar@gnat.com> writes:
| > 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.
|
| But after the free, p1 has an undefined value, and indeed the comparison
| p1==p2 is undefined at that point, so it is certainly not something the
| compiler has to worry about.
That is true.
The specification of realloc does not say the pointer is free()ed.
-- Gaby