How FORTRAN allocates addresses for COMMON blocks?
Adam Lewis
ALEWIS%UTCVM.BITNET at cunyvm.cuny.edu
Fri Jul 22 07:27:03 AEST 1988
Our group here at CECA is attempting to port a large finite
elements program written in FORTRAN to a 68020 machine running
Sys V. The particular compiler we're using is the from SVS.
The program that we are working on attempts to simulate
variable length arrays in FORTRAN by using overlapped COMMON
blocks and the fact that FORTRAN does not do array bounds range
checking. The problem is that one needs to know exactly how your
COMMON blocks are allocated addresses in order to avoid overwriting
something that you shouldn't overwrite. Maybe an example will help
make sense of this. Suppose you have two COMMON blocks:
COMMON /A/ IA(1)
COMMON /B/ IAVAIL(99),LWRD
and assume that you know that the COMMON blocks are allocated storage
based upon lexographic order (this is the way that the FORTRAN
compiler under VMS allocates storage for COMMON blocks). As long as
you take care not to place anything past the end of the /B/ COMMON
block, you can run subscripts for the array IA from 1 to 100.
Does anybody out there have any idea how the different FORTRAN
compilers for UNIX assign addresses to COMMON blocks? It would seem
to me that this kind of thing can differ greatly from compiler to
compiler. We have not yet been able to determine just how our
compiler does this. If anybody has some ideas, please drop a message
and I'll summarize the results to the net.
----------------------------------------------------------------------
Adam Lewis
Center of Excellence for Computer Applications
University of Tennessee, Chattanooga
Chattanooga, TN 37403-2598
(615)755-4388
I-net: ALEWIS at UTCVM.BITNET
----------------------------------------------------------------------
More information about the Comp.unix.wizards
mailing list