re PR fortran/40451 ([F03] procedure pointer assignment rejected)

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

	PR fortran/40451
	* resolve.c (resolve_contained_fntype): Prevent implicit typing for
	procedures with explicit interface.
	* symbol.c (gfc_check_function_type): Ditto.

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

	PR fortran/40451
	* gfortran.dg/proc_ptr_result_4.f90: New.

From-SVN: r148652
This commit is contained in:
Janus Weil 2009-06-18 10:09:40 +02:00
parent c637b0fa0d
commit f99098233b
5 changed files with 30 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2009-06-18 Janus Weil <janus@gcc.gnu.org>
PR fortran/40451
* resolve.c (resolve_contained_fntype): Prevent implicit typing for
procedures with explicit interface.
* symbol.c (gfc_check_function_type): Ditto.
2009-06-16 Ian Lance Taylor <iant@google.com>
* decl.c (build_struct): Rewrite loop over constructor elements.

View File

@ -347,7 +347,7 @@ resolve_contained_fntype (gfc_symbol *sym, gfc_namespace *ns)
return;
/* Try to find out of what the return type is. */
if (sym->result->ts.type == BT_UNKNOWN)
if (sym->result->ts.type == BT_UNKNOWN && sym->result->ts.interface == NULL)
{
t = gfc_set_default_type (sym->result, 0, ns);

View File

@ -317,7 +317,7 @@ gfc_check_function_type (gfc_namespace *ns)
if (!proc->attr.contained || proc->result->attr.implicit_type)
return;
if (proc->result->ts.type == BT_UNKNOWN)
if (proc->result->ts.type == BT_UNKNOWN && proc->result->ts.interface == NULL)
{
if (gfc_set_default_type (proc->result, 0, gfc_current_ns)
== SUCCESS)

View File

@ -1,3 +1,8 @@
2009-06-18 Janus Weil <janus@gcc.gnu.org>
PR fortran/40451
* gfortran.dg/proc_ptr_result_4.f90: New.
2009-06-17 Adam Nemet <anemet@caviumnetworks.com>
* gcc.c-torture/execute/bitfld-5.c: New test.

View File

@ -0,0 +1,16 @@
! { dg-do compile }
!
! PR 40451: [F03] procedure pointer assignment rejected
!
! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
contains
function f()
intrinsic :: sin
procedure(sin), pointer :: f
f => sin
end function f
end