(j3.2006) a question on c_f_pointer call

Jim Xia jimxia
Wed Aug 25 17:00:54 EDT 2010


j3-bounces at j3-fortran.org wrote on 08/25/2010 04:37:56 PM:

> dummy t (this is the target) really carry information in it that it is a 

> valid "deallocation target".  When do you actually calculate that (if I 
> changed 11:2:-1 to 11:3:-1 it would no longer be valid to deallocate 
it).
> 
> I am not saying you are wrong, and certainly not saying that there is no 

> confusion as to what errors the processor must detect correctly and 
> report. But I am still not convinced that c_f_pointer does anything more 

> or less than can already be done using external procedures that do 
> pointer assignments to make a pointer point to some target.
> 
> Thanks,
> Aleks
> 


I believe this is an area not considered carefully by the standard.  The 
c_f_pointer() only takes one pointer (in Fortran's sense): FPTR which 
carries the information as to whether the pointer can be deallocated.  The 
argument CPTR is not a Fortran pointer.  So when you do the pointer 
association, there are missing information as to whether this pointer can 
be deallocated or not.  Fortran array section 11:2:-1 is constructed by 
Fortran compiler (using a descriptor), therefore the compiler knows every 
piece of information about the section.  C_F_POINTER, in this sense, is 
quite different from user code purely written in Fortran.

Cheers,

Jim Xia

XL Fortran Compiler Test
IBM Toronto Lab at 8200 Warden Ave, Markham, On, L6G 1C7
Phone (905) 413-3444  Tie-line 313-3444
email: jimxia at ca.ibm.com
D2/YF7/8200 /MKM

http://www.ibm.com/software/awdtools/fortran/xlfortran
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://j3-fortran.org/pipermail/j3/attachments/20100825/8ddcc223/attachment.htm>



More information about the J3 mailing list