What could be causing a dynamic space array error in a Fortran 77 program?

Click For Summary

Discussion Overview

The discussion revolves around an error encountered in a Fortran 77 program related to dynamic space arrays. Participants explore the implications of using dynamic arrays in Fortran, the differences in compiler support, and potential memory issues arising from large array declarations.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant reports an error related to dynamic space arrays in a Fortran 77 subroutine, suggesting it may be a memory problem.
  • Another participant identifies that one of the arrays is defined to have 25 million elements, indicating a potential memory limitation on the user's machine.
  • There is a question about the version of Fortran being used and when dynamic arrays were introduced into the language.
  • Some participants note that standard Fortran 77 did not support dynamically-allocated arrays, while some compilers may have offered non-standard extensions.
  • A participant mentions that the codebase includes both Fortran 77 and Fortran 90 syntax, with the dynamic arrays specifically written in Fortran 77 style.
  • Discussion includes the observation that the ifort compiler supports dynamic arrays, while gfortran does not allow them in the same context.
  • Another participant finds that g95, a Fortran 95 compiler, supports the dynamic array syntax, which was unexpected.

Areas of Agreement / Disagreement

Participants generally agree that standard Fortran 77 does not support dynamic arrays, but there is disagreement regarding the extent to which various compilers support non-standard extensions. The discussion remains unresolved regarding the best approach to handle the memory issue.

Contextual Notes

Limitations include the uncertainty about the specific compiler settings and configurations that may affect the behavior of dynamic arrays, as well as the potential differences in memory management across different systems.

Who May Find This Useful

This discussion may be useful for programmers working with Fortran, particularly those dealing with legacy code and dynamic memory management issues in different compiler environments.

jf22901
Messages
55
Reaction score
1
Hi all

I am trying to run an executable compiled from some Fortran files (not my own), which look like they are written in Fortran 77. One of these includes some dynamic space arrays, where the number of elements depends on an integer value passed to the subroutine, e.g.

Code:
      subroutine assim (plevels,qlevels,row,number)
      implicit none
      
      integer plevels, qlevels, row, number
      
C DYNAMIC SPACE ARRAYS:
      integer array1(number)
      integer array2(number)
      
      ...
      
      return
      end

When I try to run the executable, the program gives the error message below, which I have traced back to the dynamic space array declaration. However, when someone from a different department compiles the code it works on their machine.

I guess this is some sort of memory problem? I've tried using ulimit, but get the same error. Can anyone offer any further help or insight? The error message is:

Command terminated by signal 11
0.63user 0.00system 0:00.86elapsed 74%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2482minor)pagefaults 0swaps

Many thanks
 
Technology news on Phys.org
After doing a bit more work it seems that one of the arrays is defined to have 25 million elements, hence the reason my computer hasn't enough memory! Ah well, problem sorted I guess. :rolleyes:
 
Hi jf22901. What version of Fortran are you using? I'm just trying to figure out when dynamic arrays entered into the language.
 
Standard Fortran 77 did not have dynamically-allocated arrays. Some F77 compilers may have had them as a non-standard extension, although I don't remember using any such compilers myself.
 
uart said:
Hi jf22901. What version of Fortran are you using? I'm just trying to figure out when dynamic arrays entered into the language.

It's a model that's been developed over the years, so there is some Fortran 77, and some 90. The code where the dynamic arrays are is definitely written in the syntax of Fortran 77. The compiler is ifort (which seems to allow non-standard extensions), but I know that whenever I've tried to use dynamic arrays with gfortran on my laptop it simply refuses!
 
Ok thanks. I expect that iFort will support whatever the most recent Fortran specifications are and possibly some extensions.

BTW. I just now checked this with g95 (the gnu fortran 95 compiler) and it also supports arrays defined like this. This is interesting as I didn't expect that.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 8 ·
Replies
8
Views
4K
Replies
7
Views
3K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 13 ·
Replies
13
Views
3K