Comment

Comment by londons_explore

There is some code that does unintialized reads on purpose.

For example highly vectorized loops that process a big buffer of data, but might read a bit out of bounds at the start or end of the buffer. The algorithm as a whole is guaranteed not to depend on the outcomes of those out of bounds reads, so as long as they can be guaranteed not to segfault, they should be safe.

Not allowing this usually results in either slower code (can't vectorize as much) or bigger code (need to have a special case codepath for the first/last items to be processed). The bigger code is often slower too due to worse branch prediction, more cache pressure, etc.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton