Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!umd5!brl-adm!adm!ALEWIS%UTCVM.BITNET@cunyvm.cuny.edu From: ALEWIS%UTCVM.BITNET@cunyvm.cuny.edu (Adam Lewis) Newsgroups: comp.unix.wizards Subject: How FORTRAN allocates addresses for COMMON blocks? Message-ID: <16593@brl-adm.ARPA> Date: 21 Jul 88 21:27:03 GMT Sender: news@brl-adm.ARPA Lines: 34 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@UTCVM.BITNET ----------------------------------------------------------------------