[Bug fortran/41139] [4.5 Regression] a procedure pointer call as actual argument

janus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Aug 21 13:51:00 GMT 2009



------- Comment #2 from janus at gcc dot gnu dot org  2009-08-21 13:51 -------

> Beware the forbidden recursive I/Os!

This is not the issue here. The following variation has no recursive I/O, but
gives the same segfault:

PROGRAM test

 PROCEDURE(add), POINTER :: f
 logical :: g

 ! Passing the function works
 g=greater(4.,add(1.,2.))
 print *,g

 ! Passing the procedure pointer fails
 f => add
 g=greater(4.,f(1.,2.))
 print *,g

CONTAINS

 REAL FUNCTION add(x,y)
   REAL, INTENT(in) :: x,y
   print *,"add:",x,y
   add = x+y
 END FUNCTION add

 LOGICAL FUNCTION greater(x,y)
   REAL, INTENT(in) :: x, y
   greater = (x > y)
 END FUNCTION greater

END PROGRAM test


-- 


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



More information about the Gcc-bugs mailing list