This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: malloc attributes and realloc


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]