------- Comment #1 from dominiq at lps dot ens dot fr  2008-08-27 11:00 -------
Hit return too early!-(

The following code

module myMod
  CONTAINS
  real function proc3( arg1 )
     integer :: arg1
     proc3 = arg1+7
  end function proc3
  subroutine proc4( arg1 )
!     real, external :: arg1
     procedure(real), pointer :: arg1
     print*, 'the func: ', arg1(0)
  end subroutine proc4
  end module myMod

  program myProg
     use myMod
     PROCEDURE (), POINTER :: p => NULL()
     p => proc3
!     print*, 'the func: ', p(0)
     call proc4( p )
  end program myProg

is rejected with:

[ibook-dhum] f90/bug% gfc pointer_subs_red.f90
pointer_subs_red.f90:19.16:

     call proc4( p )
               1
Error: Type/rank mismatch in argument 'arg1' at (1)

It is accepted if I uncomment the second commented line, but leads to PR27253.

Additional question: is it valid to replace

procedure(real), pointer :: arg1

with

real, external :: arg1

? Janus Weil says no and the changed code gives the same error as the original
one.


-- 


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

Reply via email to