The F95 standard says (12.6): "A pure procedure is [...] or (4) A statement
function that references only pure functions." But gfortran doesn't like that:

$ cat a5.f90 
INTEGER :: st1,i,a(4) 
st1(i)=i*i*i 
FORALL(i=1:4) a(i)=st1(i) 
print *, a
print *, u(2)

contains
pure integer function u(x)
  integer,intent(in) :: x

  st2(i) = i*i
  u = st2(x)
end function

END 
$ gfortran a5.f90
 In file a5.f90:12

  u = st2(x)
     1
Error: Function reference to 'st2' at (1) is to a non-PURE procedure within a
PURE procedure
 In file a5.f90:3

FORALL(i=1:4) a(i)=st1(i) 
                  1
Error: reference to non-PURE function 'st1' at (1) inside a FORALL block


-- 
           Summary: Statement functions are not recognized as pure when they
                    are
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29389

Reply via email to