Re: runtime error

34 views
Skip to first unread message

Thomas Koenig

unread,
Aug 1, 2022, 12:29:25 PMAug 1
to
Thando Mothogoane <ramod...@gmail.com> schrieb:
> Dear Fortran team,
>
> Can you please assist me with solving the error:
>
> compute-060:/idia/users/thando/magphys> ./make_zgrid
> 0
> At line 64 of file make_zgrid.f
> Fortran runtime error: Index '0' of dimension 2 of array 'flux_obs' below lower bound of 1

The error message is quite informative.

It's good that you compiled with bounds checking on. So, look at
the line 64 of make_zgrid.f, check the second index of the array
flux_obs and you will hopefully see where it is zero instead of 1
(which is the default lower bound), so

real :: flux_obj(10)

will declare an array for which flux_obj(1) is the first and
flux_obj(10) the last element. If you want indices ranging from
0 to 9 instead, you can specify

real :: flux_obj(0:9)

> Error termination. Backtrace:
>#0 0x7f988749ad5a
>#1 0x7f988749b869
>#2 0x7f988749bee6
>#3 0x55d5dc7f7cb8
>#4 0x55d5dc7f8e1b
>#5 0x7f98871600b2
>#6 0x55d5dc7f718d
>#7 0xffffffffffffffff

That can be made a bit more informative (if necessary) by
specifying -g as a compile option.
Reply all
Reply to author
Forward
0 new messages