Fw: Is it a bug?
Paul Thomas
paulthomas2@wanadoo.fr
Fri Jan 28 06:01:00 GMT 2005
Yes, it is a bug. Whilst it looks like some others involving various kinds
of function return values, I do not think that this one has been reported.
I modified your main program to
integer,pointer::rm
integer,target ::rm2
rm=>fun_ptr(4,5) ! return to pointer => *ptr OK =4
print*,rm
print *, fun_ptr(5,4) ! return to temporary => ptr !OK
rm2=fun_ptr(5,4)
print *, rm2 ! return to target => ptr !OK
end program ptr
The first print gives the correct answer(4), whilst two and three do indeed
print the respective pointers.
Digital Fortran gives three fours.
Paul T
More information about the Fortran
mailing list