------- Comment #11 from pault at gcc dot gnu dot org 2008-01-01 17:11 -------
This is a most peculiar bug, which has nothing to do with allocatability or
temporariness. The result variables of the functions 'get_numbr' and
'get_nfirst' are REAL(mp), whereas they are assigned to INTEGER arrays.
Changing the results to INTEGER in the original clears the problem and, up to
missing input files, the code seems OK.
This very much reduced example illustrates the problem:
module m1
integer :: numclusters = 2
end module m1
module m2
contains
function get_nfirst( ) result(fnres)
use m1, only: numclusters
real :: fnres(numclusters) ! change to REAL and it works!!
end function get_nfirst
end module m2
program kmeans_driver
use m1
use m2
integer :: nfirst(3)
nfirst(1:numclusters) = get_nfirst( )
end program kmeans_driver
Alternatively, moving the USE m1 in 'get_nfirst' to be a module specification
statement, fixes the problem.....:)
I'm thinking about it; the offending version of numclusters is linked to a
namespace that has no proc_name. Why this should cause problems when there is
a type mismatch, I have no idea.
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34545