(j3.2006) Submodule/module interface mismatch: is thisstandard-conforming?
Malcolm Cohen
malcolm
Sat Oct 8 03:21:39 EDT 2016
The interface body by itself is conforming; if you read the IMPLICIT
statement, it says that the implicit mapping in an interface body with no
IMPLICIT statement is the usual Fortran REAL(A-H,O-Z) INTEGER(I-N), but the
later separate module procedure has different characteristics, so that is
not conforming.
Neither gfortran nor Intel are conforming in this regard (you might need to
use some special option to get standard conformance though), as they do not
satisfy the constraint:
C1556 (R1527) If MODULE appears in the prefix of a module subprogram, the
subprogram shall specify the same characteristics and dummy argument names
as its corresponding module procedure interface body.
The first error message of the Cray compiler would appear to indicate
nonconformance, but the second error message seems to be correct.
-----Original Message-----
From: Damian Rouson
Sent: Saturday, October 8, 2016 8:22 AM
To: j3
Cc: GCC-Fortran-ML
Subject: (j3.2006) Submodule/module interface mismatch: is
thisstandard-conforming?
All,
Is the program below standard-conforming? The Cray compiler gives an error
message stating that the IMPLICIT NONE disallows the implicitly typed
interface body and and a second error message reporting a conflict between
the interface body and and the module function in the submodule. This is
the behavior I would hope would be the intention of the standard, but I?m
not certain it is the standard behavior.
The gfortran 6.1.0 compiler compiles the program without errors and prints
the following:
9.18340949E-41 is not 1
The Intel 16.0 compiler compiles the program without errors and prints the
following:
1.000000 is not 1
Despite my hopes, I suspect the interface body is standard-conforming on the
grounds that the IMPLICIT statement does not apply to the interface block.
Nonetheless, I suspect that having an interface body that refers to a
procedure with the same names as a different procure in the a child
submodule makes the program non-conforming.
Damian
module one_module
implicit none
interface
module function one()
end function
end interface
end module
submodule(one_module) one_submodule
implicit none
contains
integer module function one()
one = 1
end function
end submodule
use one_module
print *,one()," is not ",1
end
_______________________________________________
J3 mailing list
J3 at mailman.j3-fortran.org
http://mailman.j3-fortran.org/mailman/listinfo/j3
________________________________________________________________________
This e-mail has been scanned for all viruses by Star.
________________________________________________________________________
More information about the J3
mailing list