[Patch, Fortran] PR 39997/40541

Janus Weil janus@gcc.gnu.org
Fri Jun 26 09:31:00 GMT 2009


Hi all,

here is a patch which does several things:

1) It enables the interface checking for procedure pointer
assignments, where the rhs is a function returning a procedure pointer
(i.e. PR 40451).

2) If external procedures without an explicit return type cannot be
implicitly typed, they get the 'subroutine' attribute (i.e. PR 39997
comment #3, lower part).

3) Both of these changes together revealed a couple of invalid test
cases (which were mostly due to a misunderstanding on my side
regarding the usage of PROCEDURE statements with implicit interfaces).
Those have been fixed. This also includes proc_ptr_result_1.f90, which
has been failing lately after a patch by Richard, but now works again.

4) A small fix for procedure pointer results, where in some cases the
type of the return value was not recognized (also revealed by the
extended checking).

Regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus


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

	PR fortran/39997
	PR fortran/40541
	* decl.c (add_hidden_procptr_result): Copy the typespec to the hidden
	result.
	* expr.c (gfc_check_pointer_assign): Enable interface check for
	procedure pointer assignments where the rhs is a function returning a
	procedure pointer.
	* resolve.c (resolve_symbol): If an external procedure with unspecified
	return type can not be implicitly typed, it must be a subroutine.


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

	PR fortran/39997
	PR fortran/40541
	* gfortran.dg/proc_ptr_15.f90: Fixed and extended.
	* gfortran.dg/proc_ptr_common_1.f90: Fixed invalid test case.
	* gfortran.dg/proc_ptr_result_1.f90: Ditto.
	* gfortran.dg/proc_ptr_result_5.f90: New.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr40541.diff
Type: text/x-diff
Size: 4834 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090626/9200aac7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proc_ptr_result_5.f90
Type: application/octet-stream
Size: 434 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090626/9200aac7/attachment.obj>


More information about the Fortran mailing list