(j3.2006) Interpretation request SOURCE= in PURE procedures

Dan Nagle dannagle
Tue Jan 1 17:21:08 EST 2013


Hi,

Calling dos2unix
 Upload complete, url is
 
 http://j3-fortran.org/doc/year/13/13-226.txt 

 Your paper # is 
 13-226 

Hint: you must have a header in the paper, so
the subject, author and so on can be abstracted
for the paper paper.

On Jan 1, 2013, at 12:39 , Richard hendrickson <dick.hendrickson at att.net> wrote:

> 
> Here's an attempt at an interpretation request.  Unfortunately, I've forgotten how to make 
> the document submitter work.  I hope someone can do enough reformatting to put it in 
> the paper queue.
> 
> Dick Hendrickson
> 
> ------------------------------
> 
>                                                      J3/13-yy
> NUMBER: F08/ZZZZ
> TITLE: Can an allocate with SOURCE= have side-effects 
> 
> in a Pure procedure?
> KEYWORDS: Allocate, SOURCE=, PURE, side-effects
> DEFECT TYPE: Erratum
> STATUS: Under J3 consideration
> 
> QUESTION:
> 
> 
> On comp.lang.fortran Ian Harvey brought up a pointer/PURE 
> question.  
> 
> Given a type definition like
> 
>  type :: int_ptr
>     integer, pointer :: i
>  end type int_ptr
> 
> And a PURE function like
> 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
> 
> 
> Is 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, which means that the assignment to tmp%i 
> 
> can have side effects.
> 
> 
> C1283(1) prevents usage like
>     arg%i = 2
> ANSWER 
> Of course it isn't standard conforming!  
> Words modeled after C1283(4) will be added.
> 
> EDITS 
> 
> Add to C1283:  "..."
> 
> SUBMITTED BY: Dick Hendrickson
> 
> HISTORY: 13-WWW    m200  F08/ZZZZ submitted
> 
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3

-- 
Cheers!

Dan Nagle







More information about the J3 mailing list