I tried to compile some codes, and got the following message:
pgf95 -fastsse -Mipa=fast,inline -Mallocatable=03 test.f90
IPA: Recompiling test.obj: stale object file
test:
27, module subprogram string2array not inlined – wrong number of arguments
What does that mean? There was no compile error and the results were correct.
The code I used is as followings:
module strlib
contains
function String2Array(s) result(a)
character(len=*), intent(in) :: s
character, dimension(len_trim(s)) :: a
integer :: i
do i = 1, len_trim(s)
a(i) = s(i:i)
end do
end function
end module
program test
use strlib
character, dimension(:), allocatable :: strArray
character(len=20) :: str
integer :: i
str = "This is a test"
strArray = String2Array(str)
do i = 1, size(strArray)
print *, strArray(i)
end do
end program
That message disappeared when I took the function out of the module.
program test
character, dimension(:), allocatable :: strArray
character(len=20) :: str
integer :: i
str = "This is a test"
strArray = String2Array(str)
do i = 1, size(strArray)
print *, strArray(i)
end do
contains
function String2Array(s) result(a)
character(len=*), intent(in) :: s
character, dimension(len_trim(s)) :: a
integer :: i
do i = 1, len_trim(s)
a(i) = s(i:i)
end do
end function
end program
So, what is the difference between the above two codes?