Skip to content

loop upper limit causes array reference out of bounds #1

@zhenggennj

Description

@zhenggennj
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions