[Bug middle-end/82286] Wrong array subscript is above array bounds
hermantenbrugge at home dot nl
gcc-bugzilla@gcc.gnu.org
Tue Sep 26 16:39:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82286
--- Comment #4 from Herman ten Brugge <hermantenbrugge at home dot nl> ---
Created attachment 42238
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42238&action=edit
modified test case
I modified the testcase a little bit and did some debugging.
The code outputs a failure if compiled with:
gcc -O3 -Wall -c tst.c -DERROR -fdump-tree-cunrolli-details
tst.c: In function 'mtrx_decompose_matrix':
tst.c:34:17: warning: array subscript is above array bounds [-Warray-bounds]
sum += tmp.data[row][sub];
The code is ok of compiled with:
gcc -O3 -Wall -c tst.c -DERROR -fdump-tree-cunrolli-details
-fno-aggressive-loop-optimizations
or:
gcc -O3 -Wall -c tst.c -fdump-tree-cunrolli-details
The dumpfile that are created are in case of error containing or if
-fno-aggressive-loop-optimizations is given:
...
Analyzing # of iterations of loop 3
exit condition [0, + , 1](no_overflow) < row_8
bounds on difference of bases: 0 ... 4294967294
result:
# of iterations row_8, bounded by 4294967294
...
The dumpfile looks correct in the case the sqrtf function is not used:
...
Analyzing # of iterations of loop 3
exit condition [0, + , 1](no_overflow) < row_5
bounds on difference of bases: 0 ... 5
result:
# of iterations row_5, bounded by 5
...
Something must go wrong when aggressive-loop-optimizations is enabled.
More information about the Gcc-bugs
mailing list