• writing a module file in gfortran 14

    From Lynn McGuire@lynnmcguire5@gmail.com to comp.lang.fortran on Tue Dec 3 17:02:59 2024
    From Newsgroup: comp.lang.fortran

    Is the "implicit none" in the proper place in the following code ? I misspelled an argument name declaration and gfortran 14 did not complain
    when compiling my module file. However, it implicitly declared the
    argument variable to be real*4 and then complained when it compiled my subroutine code that the subroutine was declared differently.


    module aaa_modules

    implicit none

    INTERFACE
    SUBROUTINE ABCPAR(ISW,IRETST,IR,IC,PAR,IPHASE)
    INTEGER(KIND=8) :: ISW
    INTEGER(KIND=8) :: IRETST
    INTEGER(KIND=8) :: IR
    INTEGER(KIND=8) :: IC
    REAL(KIND=8) :: PAR
    INTEGER(KIND=8) :: IPHASE
    END SUBROUTINE ABCPAR
    END INTERFACE

    INTERFACE
    SUBROUTINE ABSR(NIN,NOUT,NOCOMP,NEQP,NDSP,SIVPFR,SITEMP, &
    &SIPRES,SIENTH,SIENTR,SIMOLE,SICOMP,SIKV,SOVPFR,SOTEMP,SOPRES, &
    &SOENTH,SOENTR,SOMOLE,SOCOMP,SOKV,EQPAR,DESPAR)
    INTEGER(KIND=8) :: NDSP
    INTEGER(KIND=8) :: NEQP
    INTEGER(KIND=8) :: NOCOMP
    INTEGER(KIND=8) :: NOUT
    INTEGER(KIND=8) :: NIN
    REAL(KIND=8) :: SIVPFR(NIN)
    REAL(KIND=8) :: SITEMP(NIN)
    REAL(KIND=8) :: SIPRES(NIN)
    REAL(KIND=8) :: SIENTH(NIN)
    REAL(KIND=8) :: SIENTR(NIN)
    REAL(KIND=8) :: SIMOLE(NIN)
    REAL(KIND=8) :: SICOMP(NOCOMP,NIN)
    REAL(KIND=8) :: SIKV(NOCOMP,NIN)
    REAL(KIND=8) :: SOVPFR(NOUT)
    REAL(KIND=8) :: SOTEMP(NOUT)
    REAL(KIND=8) :: SOPRES(NOUT)
    REAL(KIND=8) :: SOENTH(NOUT)
    REAL(KIND=8) :: SOENTR(NOUT)
    REAL(KIND=8) :: SOMOLE(NOUT)
    REAL(KIND=8) :: SOCOMP(NOCOMP,NOUT)
    REAL(KIND=8) :: SOKV(NOCOMP,NOUT)
    REAL(KIND=8) :: EQPAR(NEQP)
    REAL(KIND=8) :: DESPAR(NDSP)
    END SUBROUTINE ABSR
    END INTERFACE
    ...

    Thanks,
    Lynn
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Thomas Koenig@tkoenig@netcologne.de to comp.lang.fortran on Wed Dec 4 20:11:34 2024
    From Newsgroup: comp.lang.fortran

    Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
    Is the "implicit none" in the proper place in the following code ?

    No.

    [snip]

    You want

    module aaa_modules

    implicit none

    INTERFACE
    SUBROUTINE ABCPAR(ISW,IRETST,IR,IC,PAR,IPHASE)
    IMPLICIT NONE

    ...

    because declarations in the outer module have no meaning on
    interfaces.

    A rather frequent source of confusion, I'm afraid (I got bitten
    by this myself in the past).
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lynn McGuire@lynnmcguire5@gmail.com to comp.lang.fortran on Wed Dec 4 15:20:04 2024
    From Newsgroup: comp.lang.fortran

    On 12/4/2024 2:11 PM, Thomas Koenig wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
    Is the "implicit none" in the proper place in the following code ?

    No.

    [snip]

    You want

    module aaa_modules

    implicit none

    INTERFACE
    SUBROUTINE ABCPAR(ISW,IRETST,IR,IC,PAR,IPHASE)
    IMPLICIT NONE

    ...

    because declarations in the outer module have no meaning on
    interfaces.

    A rather frequent source of confusion, I'm afraid (I got bitten
    by this myself in the past).

    Woof ! I was afraid of that. The Fortran Module definition seems to be
    very fragile.

    That is going to be painful to add to my module file.

    Lynn

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Gary Scott@garylscott@sbcglobal.net to comp.lang.fortran on Wed Dec 4 18:40:08 2024
    From Newsgroup: comp.lang.fortran

    On 12/4/2024 3:20 PM, Lynn McGuire wrote:
    On 12/4/2024 2:11 PM, Thomas Koenig wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
    Is the "implicit none" in the proper place in the following code ?

    No.

    [snip]

    You want

           module aaa_modules

                implicit none

                INTERFACE
                  SUBROUTINE ABCPAR(ISW,IRETST,IR,IC,PAR,IPHASE) >>                   IMPLICIT NONE

    ...

    because declarations in the outer module have no meaning on
    interfaces.

    A rather frequent source of confusion, I'm afraid (I got bitten
    by this myself in the past).

    Woof !  I was afraid of that.  The Fortran Module definition seems to be very fragile.

    That is going to be painful to add to my module file.

    Lynn

    The interface is its own entity. I think the design is correct in
    requiring the implicit none to be repeated. While I might have
    preferred a "file scope" design more, as long as there is consistency in
    the design, I'm ok with it.

    Sorry for the direct email :( intended to post here
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.lang.fortran on Thu Dec 5 01:45:28 2024
    From Newsgroup: comp.lang.fortran

    On Wed, 4 Dec 2024 18:40:08 -0600, Gary Scott wrote:

    I think the design is correct in requiring the implicit none to be
    repeated.

    The sooner that implicit “IMPLICIT NONE” is added to the standard, the better, I think.

    In the meantime, gfortran (which is all anybody seems to be using anyway)
    has “-fimplicit-none” ...
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Gary Scott@garylscott@sbcglobal.net to comp.lang.fortran on Wed Dec 4 20:33:00 2024
    From Newsgroup: comp.lang.fortran

    On 12/4/2024 7:45 PM, Lawrence D'Oliveiro wrote:
    On Wed, 4 Dec 2024 18:40:08 -0600, Gary Scott wrote:

    I think the design is correct in requiring the implicit none to be
    repeated.

    The sooner that implicit “IMPLICIT NONE” is added to the standard, the better, I think.

    In the meantime, gfortran (which is all anybody seems to be using anyway)
    has “-fimplicit-none” ...

    I've long favored that. The consensus when it was discussed in the 90s
    was that it would never happen.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lynn McGuire@lynnmcguire5@gmail.com to comp.lang.fortran on Wed Dec 4 21:43:24 2024
    From Newsgroup: comp.lang.fortran

    On 12/4/2024 7:45 PM, Lawrence D'Oliveiro wrote:
    On Wed, 4 Dec 2024 18:40:08 -0600, Gary Scott wrote:

    I think the design is correct in requiring the implicit none to be
    repeated.

    The sooner that implicit “IMPLICIT NONE” is added to the standard, the better, I think.

    In the meantime, gfortran (which is all anybody seems to be using anyway)
    has “-fimplicit-none” ...

    Yes, "implicit none" should have been made the default in the Fortran 90 version. With all of the changes, it was time.

    Lynn

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Steven G. Kargl@sgk@REMOVEtroutmask.apl.washington.edu to comp.lang.fortran on Sat Dec 7 05:42:20 2024
    From Newsgroup: comp.lang.fortran

    On Wed, 04 Dec 2024 20:11:34 +0000, Thomas Koenig wrote:

    Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
    Is the "implicit none" in the proper place in the following code ?

    No.


    Technically, the answer is 'yes' to the question asked.


    You want

    module aaa_modules

    implicit none

    INTERFACE
    SUBROUTINE ABCPAR(ISW,IRETST,IR,IC,PAR,IPHASE)
    IMPLICIT NONE

    ...

    because declarations in the outer module have no meaning on
    interfaces.

    This is the answer to the question you meant to ask. An interface
    construct introduces a new namespace and blocks host association.
    As such, Fortran's implicit typing rules apply
    --
    steve

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Steven G. Kargl@sgk@REMOVEtroutmask.apl.washington.edu to comp.lang.fortran on Sat Dec 7 05:44:56 2024
    From Newsgroup: comp.lang.fortran

    On Thu, 05 Dec 2024 01:45:28 +0000, Lawrence D'Oliveiro wrote:

    On Wed, 4 Dec 2024 18:40:08 -0600, Gary Scott wrote:

    I think the design is correct in requiring the implicit none to be
    repeated.

    The sooner that implicit “IMPLICIT NONE” is added to the standard, the better, I think.

    IMPLICIT NONE is a part of the Fortran standard. It's been
    a part for a very long time. Perhaps, you meant that IMPLICIT
    NONE should be the default behavior. That will never happen.
    --
    steve

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.lang.fortran on Sat Dec 7 07:48:48 2024
    From Newsgroup: comp.lang.fortran

    On Sat, 7 Dec 2024 05:44:56 -0000 (UTC), Steven G. Kargl wrote:

    On Thu, 05 Dec 2024 01:45:28 +0000, Lawrence D'Oliveiro wrote:

    On Wed, 4 Dec 2024 18:40:08 -0600, Gary Scott wrote:

    I think the design is correct in requiring the implicit none to be
    repeated.

    The sooner that implicit “IMPLICIT NONE” is added to the standard, the >> better, I think.

    IMPLICIT NONE is a part of the Fortran standard.

    Note what I said: implicit “IMPLICIT NONE”.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lynn McGuire@lynnmcguire5@gmail.com to comp.lang.fortran on Sat Dec 7 17:04:58 2024
    From Newsgroup: comp.lang.fortran

    On 12/4/2024 6:40 PM, Gary Scott wrote:
    On 12/4/2024 3:20 PM, Lynn McGuire wrote:
    On 12/4/2024 2:11 PM, Thomas Koenig wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
    Is the "implicit none" in the proper place in the following code ?

    No.

    [snip]

    You want

           module aaa_modules

                implicit none

                INTERFACE
                  SUBROUTINE ABCPAR(ISW,IRETST,IR,IC,PAR,IPHASE) >>>                   IMPLICIT NONE

    ...

    because declarations in the outer module have no meaning on
    interfaces.

    A rather frequent source of confusion, I'm afraid (I got bitten
    by this myself in the past).

    Woof !  I was afraid of that.  The Fortran Module definition seems to
    be very fragile.

    That is going to be painful to add to my module file.

    Lynn

    The interface is its own entity.  I think the design is correct in requiring the implicit none to be repeated.  While I might have
    preferred a "file scope" design more, as long as there is consistency in
    the design, I'm ok with it.

    Sorry for the direct email :( intended to post here

    No worries ! I only check the gmail email every week or two.

    Thanks,
    Lynn

    --- Synchronet 3.20a-Linux NewsLink 1.114