Hi, > > module foo > > contains > > function bar(i) > > integer, allocatable :: bar > > integer, intent(in) :: i > > if (i > 0) bar = i > > end function bar > > end module foo > > > > program test > > use foo > > integer j > > j = bar( 3); print *, j > > j = bar(-3); print *, j > > end if > > end program test > > > > Even if Andre developed a patch to allocate memory in > > bar() for the i <= 0 case to prevent the segfault, the > > function must return a value. What should that value be? > Your example is, of course, 100% invalid; a value is needed to put in j. > But the case is more debatable to me, if j is allocatable. > In that case an unallocated bar() result could just make j unallocated.
Yes, completely right. The example so far is not on the point I try to make. For your example Steve, the result of bar has to be allocated, no argument on that, but what about, when j is allocatable? As stated in a previous mail, that property is not called allocated, but allocatable... - Andre -- Andre Vehreschild * Email: vehre ad gmx dot de