https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66974
DJ Delorie <dj at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dj at redhat dot com --- Comment #1 from DJ Delorie <dj at redhat dot com> --- If elsewhere calls foo(500) you will get an actual out of bounds access. I think the warning is appropriate. Have you tried checking the value of 'order' in that function, before the loop, to validate its value? Such a check might fix your bug and silence the warning.