←back to thread

305 points todsacerdoti | 5 comments | | HN request time: 0s | source
1. anon-3988 ◴[] No.44062323[source]
Is skipping initialization of buffers a hard problem for compilers?
replies(4): >>44062623 #>>44062735 #>>44063622 #>>44068910 #
2. empath75 ◴[] No.44062623[source]
It's easy to not initialize the buffer, the hard part is guaranteeing that it's safe to read something that might not be initialized.
3. adgjlsfhk1 ◴[] No.44062735[source]
yeah. Proving that the zero initialization is useless requires proving that the rest of the program never reads one of the zeroed values. This is really difficult because compilers generally don't track individual array indices (since you often don't even know how big the array is)
4. brigade ◴[] No.44063622[source]
It’s especially hard to elide the compiler initialization when the intended initialization is by a function written in assembly
5. mastax ◴[] No.44068910[source]
In this case I assume the difficulty is the initialization happens in assembly which the compiler has no visibility into.