On 05/06/2019 15:22, Matthew Flatt wrote:
> Thanks!
>
> It looks like this happens only with -O3, so most users won't run into
> it (with the default -O2).
>
Correct.
>
> I see that changing the declaration
>
> uptr vspace_offsets[vspaces_count+1];
>
> to
>
> uptr vspace_offsets[2*vspaces_count+1];
>
> makes the error go away, but I don't know whether it's just a bug in
> array-bounds checking (in which case extending the array size should be
> harmless) or reflects a miscompilation (in which case extending the
> array size just masks a problem).
>
It is afaict, a bug in the array bounds calculation. So, increasing it
masks the problem.
I have tested latest commit from the gcc 7 branch and it still has the
problem.
/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.c: In function ‘S_vfasl’:
vfasl.c:352:134: error: array subscript is above array bounds
[-Werror=array-bounds]
I will bisect this to see what's going on just out of curiosity.
Will let you know.
--
Paulo Matos