PROCEDURE declarations

Tobias Burnus burnus@net-b.de
Tue Aug 28 20:57:00 GMT 2007


Janus Weil wrote:
> In general I am quite optimistic that all major issues are solved by
> now, though. But of course there may be some details where my
> implementation may not work correctly. So I would be grateful for some
> more review and testing of the patch. Otherwise I hope it should be
> ready for going into trunk soon ...
>   
Looks already quite good; what comes next? Intrinsic procedures,
procedure pointers* or ...?
(I saw a bit later the proc pointer patch, which kind of answers that
question.)


The following program violates:

C1212 (R1215) The name shall be the name of an abstract interface or of
a procedure that has an explicit interface.

implicit none
real f, x
f(x) = sin(x**2) ! Statement function
external oo

procedure(f) :: q ! Wrong 1
procedure(oo) :: p ! Wrong 2
print *, q(3.3)
call p()
end

procedure() or procedure(real) is allowed - which gives an implicit
interface; but if you put a procedure name there, it must have an
explicit interface.


I think for the following program one could improve the error message:

module X
external foo
interface nn
  procedure foo
end interface
end module X
end

gfortran:
Error: Procedure 'foo' in generic interface 'nn' at (1) is neither
function nor subroutine

NAG f95:
Error: line 4: FOO does not have an explicit interface

Otherwise I run out of test cases, which is a good sign :-)


Tobias


* if you are looking for one real-world application which already uses
procedure pointers (for one feature):
CP2K, http://developer.berlios.de/projects/cp2k/
This program is co-developed by Joost which filled tons of useful
bugreports; the CP2K itself is also quite effective in finding problems
in GCC/gfortran.



More information about the Fortran mailing list