According to the latest C standard draft that I could find, the semantics of realloc are that it deallocates the old object and allocates a new one. Of course, as an intended optimization, the new pointer value might have the same value as the old one, but that&#x27;s not part of the semantics.<p>The only case in which the old pointer is not invalidated is if realloc fails.<p>As far as I know, in practice, at least with GCC, but likely clang as well, the compiler doesn&#x27;t tracks the invalidation, but it simply assumes that any non null pointer returned by realloc (or any allocation function in fact) does not alias any other existing pointer in the program.