... not inlined -- wrong number of arguments

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?

Hi Jason,

I tried both versions with 7.1-3 and they both give the same warning of not inlining but at a different line. Which version of compiler do you use?

Hongyon

That’s strange, I am using version 7.1.-3 too. Anyway, what does “wrong number of arguments” mean?

Hi,

Words from our engineer:

The compiler gets confused because the result is a character array, which is handled differently than a character scalar return value.

Initial test still didn’t inline because it then thought the array argument for the result array was getting reshaped across the call.

We are going to fix this but will not be in the next release, perhaps the one after.

Thanks for reporting a problem.
Hongyon

Thanks, hongyon.