Make COMMON Names Consistent

Description:  Fortran allows different definitions of a COMMON block to give the same variable different names. This is confusing. This refactoring gives the variables the same names in all definitions of the COMMON block.

State: Implemeted         Author: Kurt Hendle     Version:   Photran 5.0

Code Example:

    program main
    implicit none

    common /block/ a, b, c, /mem/ r, f, t
    integer :: a
    real :: b
    double precision :: c
    integer :: r, f, t

    a = 5
    b = 4.6
    c = 2.345
    call helper

end program common1

subroutine helper
    implicit none
    common /block/ e, f, g
    integer :: e
    real :: f
    double precision :: g
end subroutine helper

end program


    program main
    implicit none

    common /block/ a_common, b_common, c_common, /mem/ r, f, t
    integer :: a_common
    real :: b_common
    double precision :: c_common
    integer :: r, f, t

    a_common = 5
    b_common = 4.6
    c_common = 2.345
    call helper

end program common1

subroutine helper
    implicit none
    common /block/ a_common, b_common, c_common
    integer :: a_common
    real :: b_common
    double precision :: c_common
end subroutine helper

end program


ScreenShots

           

HTML Comment Box is loading comments...