GCC Bugzilla will be upgraded from version 4.4.9 to 5.0rc3 on Saturday, April 25, starting around 17:00 UTC. The upgrade process should only last a few minutes. Check bug 64968 for details.
Bug 39998 - Procedure Pointer Assignments: Statement Functions & Internal Functions
Procedure Pointer Assignments: Statement Functions & Internal Functions
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: fortran
4.5.0
: P3 normal
: ---
Assigned To: janus
: accepts-invalid
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-01 21:43 UTC by janus
Modified: 2009-05-05 20:47 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-05-05 20:17:07


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description janus 2009-05-01 21:43:21 UTC
According to the following passage of the Fortran 2003 standard, statement functions and internal functions are forbidden in procedure pointer assignments:

C727 (R742) A procedure-name shall be the name of an external, module, or dummy procedure, a specific intrinsic function listed in 13.6 and not marked with a bullet (•), or a procedure pointer.

Test cases:

f(x) = x**2
procedure(), pointer :: p
p => f
print *, p(4.0)
end

**********

 procedure(), pointer :: p
 p => sub
contains
 subroutine sub
 end subroutine sub
end

**********

Internal functions, however, are valid in Fortran 2008.

Thanks to Tobias for reporting this.
Comment 1 janus 2009-05-05 20:41:14 UTC
Subject: Bug 39998

Author: janus
Date: Tue May  5 20:41:00 2009
New Revision: 147133

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147133
Log:
2009-05-05  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/39998
	* expr.c (gfc_check_pointer_assign): Check for statement functions and
	internal procedures in procedure pointer assignments.


2009-05-05  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/39998
	* gfortran.dg/proc_ptr_17.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/proc_ptr_17.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/testsuite/ChangeLog

Comment 2 janus 2009-05-05 20:47:47 UTC
Fixed in r147133. Closing.