Bug#1070299: Acknowledgement (gcc-14: Wrong vectorized code generated with -O3, ok without -O.)
This issue turned out to not be an gcc issue, but a badly declared
flexible / 'zero-length array' at the end of the structure, which then
relied on undefined behaviour. The declared size (here [4]) was then
apparently taken into account in the code generation.
I do not know of a way to diagnose this kind of use without warning for
basically all kinds of arrays at the end of structures. Though it would
be nice, as it was not straightforward to find the issue.
Perhaps a note in the gcc-14 upgrade notes that the compiler now uses
declared array sizes (more) to influence loop execution might be useful.
Except for that, this bug can be closed.
Reply to: