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

loop upper limit causes array reference out of bounds #1

Open
zhenggennj opened this issue Aug 7, 2023 · 0 comments
Open

loop upper limit causes array reference out of bounds #1

zhenggennj opened this issue Aug 7, 2023 · 0 comments

Comments

@zhenggennj
Copy link

  • operating system (Windows-msys2-mingw32)
  • compiler & version (GNU Fortran (Rev10, Built by MSYS2 project) 12.2.0)

In the compiling phase, a lot of messages were displayed. The last message looked like this:

IRI-2023-May/igrf.for:315:15:

  296 |       DO 3 N=3,3333
      |                            2
......
  315 | 4     T=(Z-P(3,N-1))/STEP
      |               1
Warning: Array reference at (1) out of bounds (3332 > 100) in loop beginning at (2)

The size of array P is defined by line 207:

207       DIMENSION         V(3),U(3,3),P(8,100),SP(3)

Array P was accessed in this fashion:

 298       P(1,N)=P(1,N-1)+STEP12*(5.*P(4,N)+8.*P(4,N-1)-P(4,N-2))

The "Do" loop upper limit should be 100, not 3333.

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

1 participant