This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/29389] Statement functions are not recognized as pure when they are



------- Comment #1 from fxcoudert at gcc dot gnu dot org  2006-10-31 00:09 -------
Created an attachment (id=12516)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12516&action=view)
Tentative patch

This patch doesn't work :)

It's working fine except that the following code:

  implicit none
  INTEGER :: st1,i,a(4)
  st1(i)=i*i*g(i)
  !FORALL(i=1:4) a(i)=st1(i)
  print *, a
  print *, u(2)

contains

pure integer function u(x)
  integer :: st2, i
  integer,intent(in) :: x

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

pure integer function f(x)
  integer,intent(in) :: x
  f = x
end function

integer function g(x)
  integer,intent(in) :: x
  g = x
end function
end

gives the erroneous error message:

 In file pr29389.f90:3

  st1(i)=i*i*g(i)
             1
Error: Function reference to 'g' at (1) is to a non-PURE procedure within a
PURE procedure

When the statement function is resolved, gfc_current_ns points to u. I don't
understand why.


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]