I solved the problem by declaring the result variable as POINTER instead of ALLOCATABLE. The fact is that the same cose run perfectly on a previous machine, while experienced this problem on a new one. POINTERS allow for a more powerful management of dynamically allocated memory.
I'm using a recursive function with compaq visual fortran 6.6. I've already used this feature in many programs, but now it seems to have some problem. While the computations at the lowest level seem to be correct, the final result is like out of flow.
VO( 1:M1)=funct(p1,VI( 1:N1),flag)+...