Remix.run Logo
anon-3988 a year ago

Is skipping initialization of buffers a hard problem for compilers?

brigade a year ago | parent | next [-]

It’s especially hard to elide the compiler initialization when the intended initialization is by a function written in assembly

adgjlsfhk1 a year ago | parent | prev | next [-]

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)

empath75 a year ago | parent | prev | next [-]

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.

mastax a year ago | parent | prev [-]

In this case I assume the difficulty is the initialization happens in assembly which the compiler has no visibility into.