[Bug analyzer/107566] array out of bounds not detected
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Nov 8 05:43:10 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107566
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
At -O1 GCC does detect it:
<source>: In function 'int main()':
<source>:6:29: warning: iteration 3 invokes undefined behavior
[-Waggressive-loop-optimizations]
6 | my_array[i] = i;
| ~~~~~~~~~~~~^~~
<source>:5:26: note: within this loop
5 | for(int i = 0; i < 6; i++)
| ~~^~~
More information about the Gcc-bugs
mailing list