Example 1, Shouldn’t pass
module m1
implicit none
integer :: i1, i2
end module m1
module m2
use m1, only: i1
implicit none
interface
module subroutine sub()
end subroutine sub
end interface
end module m2
submodule(m2) sm
implicit none
contains
subroutine sub()
use m1, only: i1
i2 = 1 ! i2 shouldn't be available
end subroutine sub
end submodule sm
Example2, threw a severe error:
module m1
implicit none
integer :: i1, i2
end module m1
module m2
use m1, only: i1
implicit none
integer :: i2
interface
module subroutine sub()
end subroutine sub
end interface
end module m2
submodule(m2) sm
implicit none
contains
subroutine sub()
use m1, only: i1
i2 = 1 ! i2 here is obviously the one from parent module m2
end subroutine sub
end submodule sm
error message:
NVFORTRAN-S-0155-i2 is use-associated from modules m2 and m1, and cannot be accessed (nvfortran_bug.f90: 21)
0 inform, 0 warnings, 1 severes, 0 fatal for sub
Thanks mehdi.chinoune. I’ve filed an issue report (TPR #29957) and sent it to our engineers for further investigation.
-Mat
Almost one year after the report, still not fixed!
I know I don’t have any right to complain since I use it for free, but I started trying to use PGI/Nvidia Compiler since 2015 (when I was a student), still not a compiler to rely on. I know thousands of organizations use it, but their code is almost Fortran77 (The old Microsoft Fortran Compiler Powerstation -1995- could compile it).
Let’s hope the new flang won’t end up like this one, although I see some maintainers test the compiler against apps not against what the Standard says.
I just pinged engineering to see if we can bump up the priority on this one due to it’s age. Although users on paid support get higher priority, we don’t like to let issues like this lag for this long.
Fixed with the latest release 22.5
Yes, but only partially. Example 2 will now compile but we’re still not catching the error in example 1. We opened a second report, TPR #31624, to track example 1. Per engineering it’s a difficult fix but hopefully it’s not as critical.
-Mat