Topic: Debugging array values outside array bounds

I use declarations like this ALL the time for dynamic array sizes:
      REAL*8 ArrayName(1)

Obviously, the true array dimension is usually larger, sometimes far larger, than 1.  This makes it necessary to reserve whatever memory space I will actually need for the run-time array size.  I've been using dynamic storage like this since Fortran 77 (in which the compiler provided no  dynamic storage facilities).
as a result, I haven't needed to learn how F90 does it, and I'm still using perfectly efficiently the methods I developed for dynamic storage in F77.   

Snag is, the source level debugger is a bit strict with me, and it won't permit array references beyond the array bounds.
I can't therefore monitor array variable values past the first array element.

Does the debugger have any switches for which  Simply Fortran could provide an on/off radio button somewhere to let me view array contents outside the declared bounds?  If it does then can anyone tell me how to switch this on from the debugger console untill such time as Jeff is able to consider providing a gui switch?
---
John

Re: Debugging array values outside array bounds

I doubt that support for the array construct you've explained will be added.  The debugger will use the declared static array size as the limiting size of the array itself to protect against exceeding the bounds, which could, in theory, cause both the program and the debugger to crash.  I'm a little confused as to how you're successfully getting your program to run when you exceed array bounds if that's what you're doing.  However, if it does work, I'm not one to argue.

Runtime-allocated arrays are not difficult to handle in Fortran 90 or higher.  Your declaration would typically be something like:

REAL(KIND=8), DIMENSION(:), ALLOCATABLE::ArrayName

...
    ALLOCATE(ArrayName(500))

The code above would allocate a double precision (same as REAL*8) one-dimensional array with 500 points.  You can manually deallocate as well, but the array should automatically be freed when exiting the function/subroutine/program on GNU Fortran.  The above construct should allow you to expand arrays fully within Insight.

Jeff Armstrong
Approximatrix, LLC

Re: Debugging array values outside array bounds

One of the anarchic strengths of F77 was that it allowed programmers to fly by the seat of their pants if they wanted to.  It was and always has been legal in Fortran to exceed array bounds.  Of course, one has to bear in mind that this will overwrite whatever lies next in memory but, as long as the array being overshot EITHER comes last in all declarations, OR is EQUIVALENCEd with something big and empty that reserves enough space, it works perfectly.  The only disadvantage is that programmers have to take responsible themselves for what happens, instead of relying on the compiler to look after things.

In structural analysis of skeletal frameworks, there are many arrays to declare - for the member types and node connections, node coordinates, material types and properties, support nodes and directions, spring stiffnesses, and other stuff.  Most programs define upper limits for how many members, how many nodes, how many materials, etc..  When memory is tight (and even disk space, as it was when I began this stuff on an Apple ][ with M$Fortran). one did not want to decide in advance what limits to impose, so I developed dynamic storage in F77, by lining up my arrays in sequence, all declared with array size (1) but referenced by the code using whatever large array index variables I needed, and all EQUIVALENd with a big fat COMMON array called (eg) M(1000000). 

All serious F77 coders stepped outside array bounds sometimes when they didn't know in advance the size of a user's problem but my program does it for ALL array storage.  It dies not give and has never given any problems, with any compiler I've ever used.

The advantage of how I do it is that array sizes are not decided at compile time.  With the exception of the container arrray, which grabs as much space as the entire program might need, all data arrays, ALL of them, are decided at run time.
---
John

Re: Debugging array values outside array bounds

John,

FORTRAN 77 certainly allowed this, and it was a strength of the language.  If that structure continues to work properly under GNU Fortran, I would encourage you to continue using it. 

I'll poke around in the debugger to see if there is a nice way to allow access beyond array bounds, but I can't make any promises.

Jeff Armstrong
Approximatrix, LLC

Re: Debugging array values outside array bounds

I doubt that it's do-able.
I've seached the bull debugger manual (and what a monster that is!) but I can find nothing it can be made to do to help m with this).

There's a trick I can use, which is to alter the source file by dimensioning the arrays I'm interested in to larger sizes and re-compiling but I don't like doing this in case I forget to put the dimensions back to array size (1) after the debugging session.

Please don't be concerned about this - I'll live with it.
---
J.