(j3.2006) Another question about pointers in PURE procedures

Richard hendrickson dick.hendrickson
Wed Nov 14 19:24:06 EST 2012


On comp.lang.fortran Ian Harvey brought up another pointer/PURE question.  Given 
something like

 type :: int_ptr 
    integer, pointer :: i 
 end type int_ptr 

Then is 

pure function fun (arg) 
type(int_ptr), intent(in) :: arg 
type(int_ptr), allocatable :: tmp 
fun = 1 

  allocate (tmp, source=arg) 
  tmp%i = 2 

end function fun 

standard conforming?  

Doesn't the use of source=arg  allow the function to modify a global entity via 
the tmp%i  =  ...?   There don't seem to be any constraints on what arg%i can 
point to, and then isn't tmp%i pretty much unconstrained?

This may be related to F08/0084, aka 12-174r2

Dick Hendrickson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20121114/b922ff34/attachment.html 



More information about the J3 mailing list