Silverfrost Forums

Welcome to our forums

compile F77 code with ftn: array bound error

16 Aug 2012 12:35 #10626

Dear All, I am trying to compile HWM93 model ( ftp://nssdcftp.gsfc.nasa.gov/models/atmospheric/hwm93/ ) using ftn95 personal edition, but it gives me at compile-time a set of errors like

*** Array subscript for first rank of PB, 26, is greater than the declared upper bound, 1

Is it possible to compile this model (which is F77 code) by playing some options i.e. without source code modification? (I have a plenty of code - except HWM93 - with such 'features', so modification will cause a lot of old F77 code).

PS This code is compiled with FPS4.0 without errors. The errors are due to array bounds checks (which is in F90, but not in F77).

21 Aug 2012 1:35 #10659

You could try ftn95 /? in the command prompt to see a list of compiler options. To overcome the old dimension a(1) syntax, the following compile option should overcome this for subroutine and function arguments: ftn95 program /Old_arrays

John

21 Aug 2012 12:53 #10660

I'm a big fan of Fortran 77, as a lot of the newer stuff either duplicates what is already there, or proposes an alternative - often, in my view, no better or probably worse than the original. However, when I took a look at the source code for which the link was given I was completely appalled - nobody could maintain or update code written like that.

Good luck to you Zolotovo, you are going to need it!

Eddie

23 Aug 2012 1:06 #10672

Eddie,

That was the way some codes developed, when we only had the 026 card punch! The IDE is a long way from those difficult days.

John

23 Aug 2012 9:07 #10676

John,

I never wrote code like that.

Mind you, as far as compiling and running goes, it's probably quite fast.

When you see code like that from NASA, it turns you into a believer that the moon landings WERE filmed in a studio!

Eddie

18 Dec 2025 12:08 #32558

This thread was started 13 years ago. The original NASA FTP site and the HWM93 source codes are no longer accessible. There is, however, a successor code called HWM14, which is available at https://map.nrl.navy.mil/map/pub/nrl/HWM/HWM14/. This code is provided as a .tgz file which, when extracted, provides two Fortran-90 source files, two unformatted Fortran files with data for the program, and three text files that contain the output of the program when compiled with (i) Intel Fortran, (ii) Gfortran. The unformatted Fortran files are not compatible with FTN95. I was able to build EXEs using (i) Intel Fortran compiler IFX, (ii) Gfortran 13.4.0. The output from the two EXES matched the output files in the .tgz archive quite well. Unfortunately, the program uses some real type arrays without initialization, so it is not possible to draw any conclusions without knowing whether the authors wanted zero initialization. The output results are questionable, as well.

I still have the Microsoft FPS4.0 compiler, but it failed to compile the new sources. The Compaq Visual Fortran 6.6C failed, as well.

11 Jan 2026 12:43 (Edited: 11 Jan 2026 12:47) #32687

I have modified the files of HWM14 to enable the package to be compiled and run using FTN95 (either 32-bit or 64-bit). The modified sources, FTN95 compatible unformatted data files and batch files to build the program are included in a Zip file that you can download from https://drive.google.com/file/d/1lz1z3XVZ30HUnEVyuH9UUiNhFZHA7xC0/view?usp=sharing

Please login to reply.