[Bug tree-optimization/56456] [meta-bug] bogus warning when inlining or unrolling: "array subscript is above array bounds"
slash.tmp at free dot fr
gcc-bugzilla@gcc.gnu.org
Wed Oct 18 09:12:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
--- Comment #5 from Mason <slash.tmp at free dot fr> ---
Slightly smaller testcase, similar to bug 80907.
extern int M[16];
void foo(int n)
{
for (int i = 0; i < n; ++i)
for (int j = 0; j < i; ++j)
M[i+j] = 0;
}
$ gcc-7 -O3 -Wall -S testcase4.c
testcase4.c: In function 'foo':
testcase4.c:6:5: warning: array subscript is above array bounds
[-Warray-bounds]
M[i+j] = 0;
~^~~~~
testcase4.c:6:5: warning: array subscript is above array bounds
[-Warray-bounds]
testcase4.c:6:5: warning: array subscript is above array bounds
[-Warray-bounds]
testcase4.c:6:5: warning: array subscript is above array bounds
[-Warray-bounds]
testcase4.c:6:5: warning: array subscript is above array bounds
[-Warray-bounds]
testcase4.c:6:5: warning: array subscript is above array bounds
[-Warray-bounds]
testcase4.c:6:5: warning: array subscript is above array bounds
[-Warray-bounds]
testcase4.c:6:5: warning: array subscript is above array bounds
[-Warray-bounds]
Same result with trunk.
Using -fopt-info adds:
testcase4.c:5:3: note: loop turned into non-loop; it never loops.
testcase4.c:5:3: note: loop with 17 iterations completely unrolled
More information about the Gcc-bugs
mailing list