re PR fortran/30883 ([4.1/4.2 only] procedure with dummy procedure f1 rejected with implicit none)

2007-03-11  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/30883
	* parse.c (parse_interface): Use the default types from the
	formal namespace if a function or its result do not have a type
	after parsing the specification statements.

2007-03-11  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/30883
	* gfortran.dg/interface_11.f90: New test.

From-SVN: r122822
This commit is contained in:
Paul Thomas 2007-03-11 16:17:32 +00:00
parent 13338552e2
commit f68abf4a59
4 changed files with 55 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2007-03-11 Paul Thomas <pault@gcc.gnu.org>
PR fortran/30883
* parse.c (parse_interface): Use the default types from the
formal namespace if a function or its result do not have a type
after parsing the specification statements.
2007-03-08 Brooks Moses <brooks.moses@codesourcery.com>
* intrinsic.texi: (ICHAR) Improve internal I/O note.

View file

@ -1782,6 +1782,20 @@ decl:
/* Read data declaration statements. */
st = parse_spec (ST_NONE);
/* Since the interface block does not permit an IMPLICIT statement,
the default type for the function or the result must be taken
from the formal namespace. */
if (new_state == COMP_FUNCTION)
{
if (prog_unit->result == prog_unit
&& prog_unit->ts.type == BT_UNKNOWN)
gfc_set_default_type (prog_unit, 1, prog_unit->formal_ns);
else if (prog_unit->result != prog_unit
&& prog_unit->result->ts.type == BT_UNKNOWN)
gfc_set_default_type (prog_unit->result, 1,
prog_unit->formal_ns);
}
if (st != ST_END_SUBROUTINE && st != ST_END_FUNCTION)
{
gfc_error ("Unexpected %s statement at %C in INTERFACE body",

View file

@ -1,3 +1,8 @@
2007-03-11 Paul Thomas <pault@gcc.gnu.org>
PR fortran/30883
* gfortran.dg/interface_11.f90: New test.
2007-03-11 Richard Guenther <rguenther@suse.de>
PR tree-optimization/31115

View file

@ -0,0 +1,29 @@
! { dg-do compile }
! Tests the fix for PR30883 in which interface functions and
! their results did not get an implicit type.
!
! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
!
MODULE M1
IMPLICIT NONE
CONTAINS
SUBROUTINE S1(F1, F2, G1, G2)
INTERFACE
FUNCTION F1(i, a)
END FUNCTION F1
FUNCTION F2(i, a)
implicit complex (a-z)
END FUNCTION F2
END INTERFACE
INTERFACE
FUNCTION g1(i, a) result(z)
END FUNCTION g1
FUNCTION g2(i, a) result(z)
implicit complex (a-z)
END FUNCTION g2
END INTERFACE
END SUBROUTINE S1
END MODULE
END
! { dg-final { cleanup-modules "m1" } }