Conversation

That's likely glibc what is going to be doing for their stack cache since MADV_DONTNEED is a significant performance cost for their implementation, and it doesn't become a non-issue if restricted to malloc since it still means that uninitialized memory can change between reads.
1
4
Reading uninit data being undefined instead of locking it to an unspecified value permits massive optimizations like MADV_FREE and more efficient register allocation/spilling. Similarly, other memory safety issues being undefined permits optimization / freedom of implementation.
1
5
This Tweet was deleted by the Tweet author. Learn more
There's nothing disingenuous about saying that an optimization is an optimization. Many of the things that have been mentioned in this thread have a substantial impact on optimization including the basic memory safety guarantees, which optimizers lean on very heavily.
2
1
There have just been a whole bunch of threads about these issues. It's you being disingenuous by picking out 2 specific things that are not a huge part of how optimizations are implemented. No one has claimed that those 2 things enable major optimizations. It's a strawman.
1
1
The basic memory safety guarantees provide a lot more broadly used information about memory dependencies / aliasing than type-based aliasing metadata. Even the guarantees for pointer arithmetic have a huge impact. Just try compiling code using iterators without those guarantees.
2