Hello,
we encountered a strange problem when using modules in combination with commons.
Compiling and running the following code
module junk
implicit double precision (a-h,o-z)
integer, save :: junki
common/bas/ ntqg
end module junk
!
module mytest2
contains
subroutine test(a)
use junk, only : junki
implicit double precision (a-h,o-z)
common/bas/ ntqg
double precision :: a(ntqg)
write(6,*) '42 in mytest2?:',ntqg
end subroutine
end module mytest2
!
subroutine mytest()
use mytest2
implicit double precision (a-h,o-z)
common/bas/ ntqg
double precision :: ip(ntqg)
write(6,*)'42 in mytest? :',ntqg
call test(ip)
end
!
program testx
use mytest2
implicit double precision (a-h,o-z)
common/bas/ ntqg
!setting a common variable to 42
ntqg=42
write(6,*)'42 in program?:',ntqg
call mytest()
end
produces with pgfortran 16.4-0
42 in program?: 42
42 in mytest? : 42
42 in mytest2?: 0
When line 4 of the code (common/bas/ ntqg) is disabled, the result seems correct, i.e. the dimension 42 is available in mytest2.
We would appreciate hints towards a solution.