Bug 49400 - [F08] Proc-pointer declaration in BLOCK construct
Summary: [F08] Proc-pointer declaration in BLOCK construct
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: janus
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2011-06-14 08:25 UTC by Tobias Burnus
Modified: 2011-06-18 12:48 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-06-17 20:54:14


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2011-06-14 08:25:00 UTC
Follow up to PR 49397. The following code should be parsed correctly.

Currently, one gets:

test.f90:8.8:

        Procedure(Real),Pointer :: p
        1
Error: Unclassifiable statement at (1)


(Regarding the validity, cf. also PR 49397 and IR J3/11-198.)

  Program m5
    Call s
  Contains
    Subroutine s
      Print *,g()
      block
        Procedure(Real),Pointer :: p
        p => g
        Print *,p()
      end block
    End Subroutine
  End Program
  Function g()
    g = 2
  End Function
Comment 1 janus 2011-06-17 20:54:14 UTC
(In reply to comment #0)
> Currently, one gets:
> 
> test.f90:8.8:
> 
>         Procedure(Real),Pointer :: p
>         1
> Error: Unclassifiable statement at (1)


Fixing this is trivial:


Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c	(revision 175150)
+++ gcc/fortran/decl.c	(working copy)
@@ -4970,6 +4970,7 @@ gfc_match_procedure (void)
     case COMP_MODULE:
     case COMP_SUBROUTINE:
     case COMP_FUNCTION:
+    case COMP_BLOCK:
       m = match_procedure_decl ();
       break;
     case COMP_INTERFACE:
Comment 2 janus 2011-06-18 12:36:47 UTC
Author: janus
Date: Sat Jun 18 12:36:45 2011
New Revision: 175177

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175177
Log:
2011-06-18  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/49400
	* decl.c (gfc_match_procedure): Allow PROCEDURE declarations inside
	BLOCK constructs.

2011-06-18  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/49400
	* gfortran.dg/proc_ptr_31.f90: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/proc_ptr_31.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 janus 2011-06-18 12:47:00 UTC
Fixed with r175177. Closing.
Comment 4 janus 2011-06-18 12:48:03 UTC
(In reply to comment #3)
> Fixed with r175177. Closing.

... for real!