[llvm-dev] Why is remalloc not marked as noalias?

Bhatu via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 26 02:13:21 PST 2017


Hello,

According to my understanding, it seems that the result of realloc will not
technically alias the original pointer. When the realloc is done in-place
the reference <http://en.cppreference.com/w/c/memory/realloc> says:
"The original pointer ptr is invalidated and any access to it is undefined
behavior (even if reallocation was in-place)."

Additionally from the C11 standard
<https://port70.net/~nsz/c/c11/n1570.html#6.2.4p2> we have:
"The value of a pointer becomes indeterminate when the object it points to
(or just past) reaches the end of its lifetime"

Is this enough to infer that we can safely mark realloc as noalias?

-- 
Regards
Bhatu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171226/d4208ae4/attachment.html>


More information about the llvm-dev mailing list