COMMON blocks in Fortran

Tim Prince n8tm@aol.com
Mon Jun 7 15:18:00 GMT 2010


On 6/7/2010 6:33 AM, Peter Kahn wrote:
>
>    I've downloaded g95 for Linux and am trying to get a program from 
> the 1980s to run.
>    The program consists of a main and several subroutines.  A set of 
> COMMON blocks is inserted into each of these via an INCLUDE 
> statement.  The included file is attached.  When I compile under g95, 
> the compiler gives an error message, saying that COMMON ACCESS is 
> already initialized in another programming unit.
If you want advice on this list, or, better, fortran@gcc.org, you should 
be using gfortran, the Fortran compiler distributed with gcc.  Even 
though g95 is built on gcc, for advice specific to it, you should go to 
their specific support forums.
If you want general advice about multiple implementations of Fortran, 
usenet group comp.lang.fortran is the place.
Most Fortran compilers attempt to support usage outside the standard, to 
some degree. Under the standard, DATA can initialize COMMON only in a 
BLOCK DATA, and each COMMON can be initialized in only one BLOCK DATA, 
so it is not surprising to find differences in support of non-standard 
usage, or simple refusal to deal with cases which are in violation.
You are probably right in desiring to get the program working before you 
start tearing out COMMON, but it looks like this program was developed 
in a somewhat haphazard way.

-- 
Tim Prince



More information about the Gcc-help mailing list