libcint
libcint copied to clipboard
Array out of bounds
Compiling libcint and qcint 4.4.2 gives a GCC warning
/home/susi/fedora/qcint/rawhide/qcint-4.4.2/src/eigh.c: In function '_CINTdiagonalize.part.0':
/home/susi/fedora/qcint/rawhide/qcint-4.4.2/src/eigh.c:847:14: warning: array subscript -1 is outside array bounds of 'double[289]' [-Warray-bounds]
847 | wgap[-1] = MAX(0., w[0] - werr[0] - gl);
| ^
/home/susi/fedora/qcint/rawhide/qcint-4.4.2/src/eigh.c:1463:12: note: while referencing 'work'
1463 | double work[MXRYSROOTS * 9 + 1];
| ^~~~
Is this intentional?
The -1 index will not lead to out of boundary. "wgap" points to the middle of the work buffer in all possible cases. I can change it in future release to make compiler happy