I have further investigated the failure of FTN95 to handle the recursive function qsort_int. You will recall that qsort_int takes PACK as an argument and is called from within an array constructor.
For the time being I am not able to provide a fix for this failure but I will keep it on the list of things to do.
In the mean time, I have added a new function to the library called IPACKED_SIZE@ that allows you to recode qsort_int in a way that avoids any additional computational overhead. The code below demonstrates how this will work when using the next release. Naturally IPACKED_SIZE@ will only work for FTN95. The alternative is to call COUNT using the second argument of PACK.
recursive function qsort_int ( data ) result ( sorted )
integer, dimension(:), intent(in) :: data
integer, dimension(1:size(data)) :: sorted
integer, dimension(1:size(data)) :: tmp1,tmp2,tmp3
integer isize1,isize2,isize3
if ( size(data) > 1 ) then
!$$$$$$ sorted = (/ qsort_int(pack(data(2:), data(2:) < data(1))), &
!$$$$$$ pack(data(1:), data(1:) == data(1)), &
!$$$$$$ qsort_int(pack(data(2:), data(2:) > data(1))) /)
tmp1 = pack(data(2:), data(2:) < data(1))
isize1 = ipacked_size@()
tmp1(1:isize1) = qsort_int(tmp1(1:isize1))
tmp2 = pack(data(1:), data(1:) == data(1))
isize2 = ipacked_size@()
tmp3 = pack(data(2:), data(2:) > data(1))
isize3 = ipacked_size@()
tmp3(1:isize3) = qsort_int(tmp3(1:isize3))
sorted = (/ tmp1(1:isize1), tmp2(1:isize2), tmp3(1:isize3) /)
else
sorted = data
endif
end function qsort_int