This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: malloc attributes and realloc
- From: "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- To: Nathanael Nerode <neroden at twcny dot rr dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Sat, 3 Jan 2004 11:05:30 +0000 (UTC)
- Subject: Re: malloc attributes and realloc
- References: <20040103040447.GA1283@twcny.rr.com>
On Fri, 2 Jan 2004, Nathanael Nerode wrote:
> If there was another simpler workaround (like declaring p volatile or
> something) that would be even better.
Declaring enough variables volatile ought to work. As should calling
realloc through a volatile pointer to function without the attribute.
(Were it just GCC giving the attribute built-in rather than <stdlib.h>
doing so, -fno-builtin-realloc would also do the job.)
> If there was simply *no* workaround, however, I would complain. There
> has to be a reasonable way to compare the two in the case in which you
> really want to and you know what you're doing; and it shouldn't involve
> ordering the compiler not to optimize.
Does anyone have any real code that does compare the old pointer with the
return value of realloc (in any way, whether with direct comparison, as
integers or as bit-patterns)?
--
Joseph S. Myers
jsm@polyomino.org.uk