On 12/10/2017 18:42, Jeff Law wrote: > -O3 turns on loop unrolling which often triggers false positives for the > out-of-bounds array index checks. I believe there's a number of bugs in > the BZ database WRT this issue. > > You might consider attaching your testcase to one of them. [meta-bug] bogus warning when inlining or unrolling: "array subscript is above array bounds" https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456 FWIW, I worked around the issue by making the array larger (20 elements). This inhibits GCC's eagerness to fully unroll the nested loops. Regards.