Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array out of bounds #60

Open
susilehtola opened this issue Jul 15, 2021 · 1 comment
Open

Array out of bounds #60

susilehtola opened this issue Jul 15, 2021 · 1 comment

Comments

@susilehtola
Copy link

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?

@sunqm
Copy link
Owner

sunqm commented Jul 22, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants