diff options
Diffstat (limited to 'gcc/fortran/parse.c')
-rw-r--r-- | gcc/fortran/parse.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index 6e36ea2..2d17167 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -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", |