https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90758
Bug ID: 90758
Summary: out of bounds warning with -O3
Product: gcc
Version: 7.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: pmatos at gcc dot gnu.org
Target Milestone: ---
Created attachment 46455
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46455&action=edit
testcase
There's a bad out of bounds warning in gcc7 line which seems to be fixed in
gcc8 and later which only occurs with -O3.
With the attached file and the command line:
/home/pmatos/Projects/gcc-build/gcc/cc1 -fpreprocessed vfasl.i -quiet -dumpbase
vfasl.i -m64 -msse2 -mtune=generic -march=x86-64 -auxbase vfasl -O3
-Wpointer-arith -Wextra -Werror -Wimplicit-fallthrough=0 -Wall -version -o
/tmp/ccYGabNR.s
GNU C11 (GCC) version 7.4.1 20190605 (x86_64-pc-linux-gnu)
compiled by GNU C version 8.2.1 20181127, GMP version 6.1.2, MPFR
version 4.0.2, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C11 (GCC) version 7.4.1 20190605 (x86_64-pc-linux-gnu)
compiled by GNU C version 8.2.1 20181127, GMP version 6.1.2, MPFR
version 4.0.2, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 4c52f0564d8672c9a189665c732e246d
vfasl.i: In function ‘l’:
vfasl.i:25:14: error: array subscript is above array bounds
[-Werror=array-bounds]
ay = at[ax];
~~^~~~
vfasl.i: In function ‘j’:
vfasl.i:42:11: error: ‘n’ is used uninitialized in this function
[-Werror=uninitialized]
*(a *)0 = n;
~~~~~~~~^~~
vfasl.i:45:3: note: ‘n’ was declared here
a j(ac *m, a n) { return o(m, n); }
^
cc1: all warnings being treated as errors