[J3] Is this code standard conforming?
Clune, Thomas L. (GSFC-6101)
thomas.l.clune at nasa.gov
Wed Apr 18 14:19:18 EDT 2018
I believe that the attached code is standard conforming but is generating an error with one vendor claiming that the same named entity from different modules or program units cannot be referenced. I disagree with this interpretation, and do not get similar errors with any of the other compilers that I’ve tried.
Full disclosure the attached version is slightly different than the one submitted to the vendor, but it generates the same error message. I have moved the “USE PFUNIT” line from the header of Foo_mod down to the contained subroutine.
Additional details: The error goes away if I eliminate _any_ of the 3 USE statements in the main program. If the latter 2 are both kept, sensible warning messages are generated.
The code:
module pFUnit
implicit none
interface AssertEqual
module procedure assertEqual_int_int
end interface AssertEqual
contains
subroutine assertEqual_int_int(i,j)
integer, intent(in) :: i
integer, intent(in) :: j
end subroutine assertEqual_int_int
end module pFUnit
module Foo_mod
implicit none
private
public :: Foo
public :: assertEqual
type Foo
integer :: i
contains
end type Foo
interface assertEqual
module procedure assertEqual_FooFoo
end interface assertEqual
contains
subroutine assertEqual_FooFoo(a, b)
use pFUnit
class (Foo), intent(in) :: a
class (Foo), intent(in) :: b
call assertEqual(a%i, b%i)
end subroutine assertEqual_FooFoo
end module Foo_mod
program main
use pFUnit, only : assertEqual
use Foo_mod
use Foo_mod, only: assertEqual
implicit none
end program main
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20180418/1a8412a9/attachment.html>
More information about the J3
mailing list