2 ms·
Wouldn't the compiler be capable of noticing that if the array[0] is assigned to zero while - array pointer points to pointer itself, then the pointer is set t
by GlitchMr 11y ago
Wouldn't the compiler be capable of noticing that if the array[0] is assigned to zero while
- array pointer points to pointer itself, then the pointer is set to NULL pointer (assuming architecture where float 0 and NULL are represented in memory by zero), and derefencing null pointer is an undefined behaviour
- array points to misaligned itself (possible on x86), then there is a write outside of variable bounds, and undefined behavior
- array points to part of zero_out or memset function code, however the function is constant, and cannot be changed, and this causes undefined behavior
In each of these cases, there is an undefined behavior not depending on strict aliasing.