diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2007-04-07 20:13:52 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2007-04-07 20:13:52 +0000 |
commit | e9bd9f7d5db94db21cdd566e9e00f851563edc97 (patch) | |
tree | 4952f685177a36049f5019f89ef57303fb8f5eab /gcc/fortran/symbol.c | |
parent | ca178f85a63290092282309bc58d624379f749b9 (diff) | |
download | gcc-e9bd9f7d5db94db21cdd566e9e00f851563edc97.zip gcc-e9bd9f7d5db94db21cdd566e9e00f851563edc97.tar.gz gcc-e9bd9f7d5db94db21cdd566e9e00f851563edc97.tar.bz2 |
re PR fortran/31293 (Implicit character and array returning functions)
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31293
* symbol.c (gfc_check_function_type): New function.
* gfortran.h : Add prototype for previous.
* parse.c (parse_progunit): Call it after parsing specification
statements.
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31293
* gfortran.dg/interface_12.f90: New test.
From-SVN: r123641
Diffstat (limited to 'gcc/fortran/symbol.c')
-rw-r--r-- | gcc/fortran/symbol.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index b1c5ea3..ad99595 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -253,6 +253,37 @@ gfc_set_default_type (gfc_symbol * sym, int error_flag, gfc_namespace * ns) } +/* This function is called from parse.c(parse_progunit) to check the + type of the function is not implicitly typed in the host namespace + and to implicitly type the function result, if necessary. */ + +void +gfc_check_function_type (gfc_namespace *ns) +{ + gfc_symbol *proc = ns->proc_name; + + if (!proc->attr.contained || proc->result->attr.implicit_type) + return; + + if (proc->result->ts.type == BT_UNKNOWN) + { + if (gfc_set_default_type (proc->result, 0, gfc_current_ns) + == SUCCESS) + { + if (proc->result != proc) + proc->ts = proc->result->ts; + } + else + { + gfc_error ("unable to implicitly type the function result " + "'%s' at %L", proc->result->name, + &proc->result->declared_at); + proc->result->attr.untyped = 1; + } + } +} + + /******************** Symbol attribute stuff *********************/ /* This is a generic conflict-checker. We do this to avoid having a |