(j3.2006) Submodule/module interface mismatch: is thisstandard-conforming?
Rafik Zurob
rzurob
Sun Oct 9 03:45:07 EDT 2016
IBM XL Fortran also flags the error:
$ xlf2008 x.f -qsource
** one_module === End of Compilation 1 ===
12 | integer module function one()
....a...........................
a - "x.f", line 12.4: 1513-277 (S) The function result of separate module
procedure one must have the same type and type parameters as the
corresponding function result in the module procedure interface body.
** one_submodule === End of Compilation 2 ===
** _main === End of Compilation 3 ===
1501-511 Compilation failed for file x.f.
$
I used to sometimes skip implicit none in procedure declarations in
interface bodies even though I consistently put it in the specification
section of the enclosing module/program/procedure. I changed my coding
style to always include it after I had a one character typo in a dummy
argument name that caused it be implicitly typed instead of having the TKR
info from the explicit declaration (with the correct name) I had. I think
this case is similar.
Out of curiosity, in the processors where compilation did not fail, do you
get an error if one() is explicitly given real type in the interface
block?
Regards
Rafik
j3-bounces at mailman.j3-fortran.org wrote on 07/10/2016 07:22:13 PM:
> From: Damian Rouson <damian at sourceryinstitute.org>
> To: j3 <j3 at j3-fortran.org>
> Cc: GCC-Fortran-ML <fortran at gcc.gnu.org>
> Date: 07/10/2016 07:25 PM
> Subject: (j3.2006) Submodule/module interface mismatch: is this
> standard-conforming?
> Sent by: j3-bounces at mailman.j3-fortran.org
>
>
> 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
More information about the J3
mailing list