Compiling the following program gives the error: procedure(sub) :: x 1 Error: Duplicate PROCEDURE attribute specified at (1) I think the program is valid and it is also accepted by NAG f95. module m implicit none interface bar procedure x end interface bar procedure(sub) :: x interface subroutine sub() end subroutine sub end interface end module m
The statement: procedure x is an F2003 feature allowing the word 'module' preceding as optional. If I use 'module procedure x' the test case compiles OK for me. I think I may have fixed this with my pr33162 patch. I seem to remember bumping into this 'Duplicate PROCEDURE attribute specified' error somewhere along the way.
(In reply to comment #1) > The statement: > procedure x > is an F2003 feature allowing the word 'module' preceding as optional. Note: MODULE PROCEDURE and PROCEDURE mean different things. "MODULE PROCEDURE" can only be a procedure which is a procedure from that module. "PROCEDURE" can be any procedure whose interface is explicitly known: Module procedures, use-associated procedures, external procedures (via INTERFACE or PROCEDURE(...) statement). > If I use 'module procedure x' the test case compiles OK for me. I think this implies another bug as I believe there is not any module procedure in that module. Using "MODULE PROCEDURE" other compilers give also an error: NAG f95: Error: af.f90, line 11: Undefined module procedure X g95: Error: EXTERNAL-PROC procedure 'x' at (1) is already a MODULE-PROC procedure > I think I may have fixed this with my pr33162 patch. I seem to remember > bumping into this 'Duplicate PROCEDURE attribute specified' error somewhere > along the way. I will try your pr33162 patch. (Might take a while since I have at the moment only a lousy internet connection.)
Subject: Re: PROCEDURE in module somtimes wrongly rejected burnus at gcc dot gnu dot org wrote: > ------- Comment #2 from burnus at gcc dot gnu dot org 2007-11-02 07:40 ------- > Note: MODULE PROCEDURE and PROCEDURE mean different things. > > "MODULE PROCEDURE" can only be a procedure which is a procedure from that > module. "PROCEDURE" can be any procedure whose interface is explicitly known: > Module procedures, use-associated procedures, external procedures (via > INTERFACE or PROCEDURE(...) statement). > Is that PROCEDURE(...) with or without the parenthesis? We need to parse this correctly without a doubt or we have to search the module to tell the difference? (If the 'MODULE' key word is optional for "MODULE PROCEDURE".)
Both problems fixed on the trunk (4.3.0). Other branches are not affected as PROCEDURE is new.
The check-in was the following (note the wrong bug number). Author: burnus Date: Thu Nov 8 15:28:30 2007 New Revision: 130002 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130002 Log: 2007-11-08 Tobias Burnus <burnus@net-b.de> PR fortran/33917 * interface.c (check_sym_interfaces): Disallow PROCEDURE-declared procedures for MODULE PROCEDURE. * decl.c (match_procedure_in_interface): Do not mark as procedure. 2007-11-08 Tobias Burnus <burnus@net-b.de> PR fortran/33917 * gfortran.dg/proc_decl_5.f90: New. * gfortran.dg/proc_decl_6.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/proc_decl_5.f90 trunk/gcc/testsuite/gfortran.dg/proc_decl_6.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/decl.c trunk/gcc/fortran/interface.c trunk/gcc/testsuite/ChangeLog
Subject: Bug number PR33945 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-11/msg00416.html