Re: Strange Porting Problem CVF to IVF, requesting help and ideas.



In article <i34lh2ttbreiqnh3lqqnt4rv8ekn3lodn6@xxxxxxx>,
Jim Klein <jameseklein@xxxxxxxxxxxxx> wrote:

Steve and all. I shall try Steve's switch change suggestions and plan
to convert the commons to modules. The latter is something I have
tought about but been recitent to do because of the massive size of
the job.

There may be automatic tools for this. If not, there is a
straightforward step-by-step way to do this.

1. Make a module that contains the common block and all of its
variable declarations.

2. Work through your program and replace each occurrence of the
common block declaration with the USE statement. This also requires
making all variable names the same within the different declarations
of the common block. If you are not already using it, IMPLICIT NONE
usually helps with this. After every few subprograms, recompile and
run your test cases to ensure you have done things correctly.

Note that during step 2 your code will contain a mixture of direct
common block references and indirect common block references through
the module. This is why this approach works so well, you do not
have to make all the changes at once, you can work through routine
by routine if necessary.

3. Finally you will reach a point where there are no remaining
direct common block references in your code. The only common block
declaration will be in the module. At this time, you can simply
declare the variables in the module and delete the common statement.
Recompile and test a final time, and your task is complete.

$.02 -Ron Shepard
.



Relevant Pages

  • Re: getting rid of common blocks
    ... IMPLICIT NONE everywhere to enforce declarations of local variables. ... a better approach is to move the common block ... more likely result in observable errors or at least a compiler warning. ...
    (comp.lang.fortran)
  • Re: EQUIVALENCE(variable inside module, variable outside module) ????
    ... > between MODULE, COMMON, and EQUIVALENCE, could you please ... The situation with common is really quite simple, ... The variables in the common block may be ... compiler leeway for optimizations that would otherwise be hindered. ...
    (comp.lang.fortran)
  • Re: Fortran Standard question: COMMON, SAVE and EQUIVALENCE
    ... common block to stdout. ... Somehow, with common, equivalence and extensions, I didn't get ... In your case, since you placed blank common in each routine, the first variable in blank common in the routine begins at the beginning of blank common--each is known by a different variable name locally, but the memory association determines that each is really overlaid upon each other in the sequence listed. ... There's really nothing complicated about it; the first variable in each subprogram in a given common block begins at the beginning of the given block and extends as far as it is defined within the program unit. ...
    (comp.lang.fortran)
  • Re: save statement in a module
    ... pretty much that such variables and COMMON ... Recall that if a COMMON has the SAVE attribute in one scoping unit, ... that it doesn't give the common block the SAVE attribute? ... that affects whether other declarations of the same common block must ...
    (comp.lang.fortran)
  • Re: Fortran Standard question: COMMON, SAVE and EQUIVALENCE
    ... Yes, the COMMON block itself should have the SAVE attribute, but not ... EQUIVALENCE to a COMMON variable makes that variable in the block. ...   common /block/ i2 ...
    (comp.lang.fortran)