------- Comment #4 from janus at gcc dot gnu dot org  2009-08-21 14:00 -------
Side note: If one constructs an analogous test case with PPCs, this does not
have the missing-temporary problem. But it has a different one:

PROGRAM test

 type :: t
   PROCEDURE(add), POINTER, nopass :: f
 end type
 type(t) :: o
 logical :: g

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

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

CONTAINS

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

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

END PROGRAM test


The output is:

 greater:   4.0000000       3.0000000    
 T
 greater:   4.0000000     -1.49897304E-22
 T

The dump shows the reason for this (a double '&'):

    D.1571 = o.f;
    D.1572 = D.1571 (&C.1569, &C.1570);
    g = (logical(kind=4)) greater (&C.1568, &&D.1572);


-- 


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

Reply via email to