Losing the magic
Losing the magic
Posted Dec 14, 2022 19:31 UTC (Wed) by farnz (subscriber, #17727)In reply to: Losing the magic by mathstuf
Parent article: Losing the magic
If I'm reading the standard correctly, the compiler has to output the stores, because it is possible that the program has shared that memory with an external entity using mechanisms outside the scope of the standard. What the implementation does after the memory is freed is not specified (although the implementation is allowed to assume that the memory is no longer shared with an external entity at this point), and in theory a sufficiently malicious implementation could undo those final stores after you called free, but before the memory is reused.
In practice, I don't think this is a significant concern for tricks intended to help with debugging. It is for security-oriented code, but that's not the case here.
