The following code is invalid, but currently accepted by gfortran: procedure(iabs) :: p integer :: p end It is also accepted when the two statements are reversed in order. It's not completely obvious to me whether this variant is invalid, too: procedure() :: p integer :: p It is rejected by g95, but one could argue that it is valid in the same way as: external :: p integer :: p
> procedure() :: p > integer :: p I think it is valid; ifort 11beta also accepts it. (NAG 5.1 doesn't.) Looking at "12.3.2.3 Procedure declaration statement" one sees that "PROCEDURE()" is has the same effect as the EXTERNAL statement. And together with the following, I think it makes it valid: "If proc-interface does not appear, the procedure declaration statement does not specify whether the declared procedures or procedure pointers are subroutines or functions."
Patch: http://gcc.gnu.org/ml/fortran/2009-03/msg00028.html
Subject: Bug 39414 Author: janus Date: Mon Apr 6 08:33:31 2009 New Revision: 145583 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145583 Log: 2009-04-06 Janus Weil <janus@gcc.gnu.org> PR fortran/39414 * decl.c (match_procedure_decl): Fix double declaration problems with PROCEDURE statements. * symbol.c (gfc_add_type): Ditto. 2009-04-06 Janus Weil <janus@gcc.gnu.org> PR fortran/39414 * gfortran.dg/proc_decl_21.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/proc_decl_21.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/decl.c trunk/gcc/fortran/symbol.c trunk/gcc/testsuite/ChangeLog
Committed as r145583. Closing.