Compile time interface error check


I’m using PGI Accelerator Fortran on both Windows and Linux.

In Linux, compiler gives error messages regarding wrong interface uses at compile time.

However, in Visual Fortran, the compiler does not notice it.

How can I be informed about wrong interface uses during compile time in Windows?

FYI, compiler version for Windows is 15.10, and version for Linux is 16.5.

  • Is there any predefined macro that I can use in pgf90 to distinguish Windows and Linux?

The interface check comes when a routine with

use mod_name

is using a variable defined in mod_name, and it fails because
of a mismatch between the code definition and the modfile

Otherwise, you would see the errors at runtime when the passing routine
and the accepting routine detect the mismatch.

The example I tried reported the issue on both Linux and Windows
with the command line compilers, and PVF.

module mymod
implicit none
public :: myfunc
function myfunc(x) result(y)
implicit none
integer, intent(in) :: x
integer :: y
y=2.3 * x * x
end function myfunc
end module mymod

program advanced
use mymod, only: myfunc
implicit none
! integer :: x, y
real :: x
integer :: y
x = 10.0
y = myfunc(x)
print *, “x=”, x, " y=myfunc(x)=",y
end program advanced