[LLVMdev] Reference Manual Clarifications 2

Nick Lewycky nicholas at mxc.ca
Sat Apr 19 14:21:33 PDT 2008

Chris Lattner wrote:
> On Apr 1, 2008, at 6:41 PM, Jon Sargeant wrote:
>> Regarding free, I also think your wording isn't clear enough: "If the
>> pointer is null, the result is undefined."  The free result is void.
>> Consider rewording as "If the pointer is null, the operation is valid
>> but does not free the pointer."
> It isn't though.  free(NULL) could segfault the app, for example.

That's not compatible with C free(). From

"The free function causes the space pointed to by ptr to be deallocated, 
that is, made available for further allocation. If ptr is a null 
pointer, no action occurs."

For whatever reason, I thought that free of null was a normal no-op in LLVM.


More information about the llvm-dev mailing list