(j3.2006) Procedure(), pointer: subroutine vs. function and implicit typing

Tobias Burnus burnus at net-b.de
Fri May 15 06:30:32 EDT 2009


Malcolm Cohen wrote:
> MODULE m
>    IMPLICIT LOGICAL(2)(A-Z)
>    TYPE t
>     PROCEDURE(),POINTER,NOPASS :: ptr
[...]
> PROGRAM p
>   IMPLICIT CHARACTER(37)(A-Z)
>   USE m
>   TYPE(t) i
>   PRINT *,i%ptr()

Thanks for the enlightning example. Do I understand this correctly
that it also applies for the following program and it is
therefore valid? I am asking since it is rejected by ifort, NAG f95,
sunf95, openf95, pathf95, pgf95, and gfortran. (g95 seeming properly
accepts it - and rejects it if one changes the IMPLICIT logical to
something incompatible.)

module m
  IMPLICIT logical(2)(A-Z)
  external proc
end module m

program test
use m
implicit none
logical(1) :: x
x = proc()
end program test

It makes sense, but it is still interesting that so many compilers
get it wrong.

Tobias


More information about the J3 mailing list