GCC Bugzilla has been upgraded from version 4.4.9 to 5.0rc3. If you see any problem, please report it to bug 64968.
Bug 39414 - PROCEDURE statement double declaration bug
Summary: PROCEDURE statement double declaration bug
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: janus
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2009-03-09 18:19 UTC by janus
Modified: 2009-04-06 08:36 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-03-11 16:19:44


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description janus 2009-03-09 18:19:25 UTC
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
Comment 1 Tobias Burnus 2009-03-09 22:00:31 UTC
> 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."
Comment 2 janus 2009-03-11 16:19:44 UTC
Patch: http://gcc.gnu.org/ml/fortran/2009-03/msg00028.html
Comment 3 janus 2009-04-06 08:33:44 UTC
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

Comment 4 janus 2009-04-06 08:36:53 UTC
Committed as r145583. Closing.