summaryrefslogtreecommitdiff
path: root/gcc/fortran/symbol.c
diff options
context:
space:
mode:
authorjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-09 09:39:09 +0000
committerjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-09 09:39:09 +0000
commit1e057e9bb0a329a9819696c3efbe6fcf4c7ececf (patch)
tree281a4a95643d1f27ef18644d79406042326b0862 /gcc/fortran/symbol.c
parent2ed2ad5ed6499bfd59bda08b02ccc46df4a52e03 (diff)
downloadgcc-1e057e9bb0a329a9819696c3efbe6fcf4c7ececf.tar.gz
2009-04-09 Janus Weil <janus@gcc.gnu.org>
PR fortran/36704 * decl.c (add_hidden_procptr_result): New function for handling procedure pointer return values by adding a hidden result variable. (variable_decl,match_procedure_decl,gfc_match_function_decl, gfc_match_subroutine,gfc_match_end,attr_decl1): Handle procedure pointer return values. * parse.c (parse_interface): Add EXTERNAL attribute only after FUNCTION/SUBROUTINE declaration is complete. * primary.c (replace_hidden_procptr_result): New function for replacing function symbol by hidden result variable. (gfc_match_rvalue,match_variable): Replace symbol by hidden result variable. * resolve.c (resolve_contained_fntype,resolve_function,resolve_variable, resolve_symbol): Allow for procedure pointer function results. (resolve_fl_procedure): Conflict detection moved here from 'check_conflict'. * symbol.c (gfc_check_function_type): Allow for procedure pointer function results. (check_conflict): Move some conflict detection to resolution stage. * trans-types.c (gfc_sym_type,gfc_get_function_type): Handle hidden result variables. 2009-04-09 Janus Weil <janus@gcc.gnu.org> PR fortran/36704 * gfortran.dg/external_procedures_1.f90: Modified. * gfortran.dg/proc_ptr_result_1.f90: New. * gfortran.dg/proc_ptr_result_2.f90: New. * gfortran.dg/proc_ptr_result_3.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145815 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/symbol.c')
-rw-r--r--gcc/fortran/symbol.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 6ffd869a30e..a4f43a5f670 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -320,7 +320,7 @@ gfc_check_function_type (gfc_namespace *ns)
proc->attr.allocatable = proc->result->attr.allocatable;
}
}
- else
+ else if (!proc->result->attr.proc_pointer)
{
gfc_error ("Function result '%s' at %L has no IMPLICIT type",
proc->result->name, &proc->result->declared_at);
@@ -453,10 +453,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf (entry, intrinsic);
if ((attr->if_source == IFSRC_DECL && !attr->procedure) || attr->contained)
- {
- conf (external, subroutine);
- conf (external, function);
- }
+ conf (external, subroutine);
conf (allocatable, pointer);
conf_std (allocatable, dummy, GFC_STD_F2003);
@@ -626,14 +623,13 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
break;
case FL_PROCEDURE:
- /* Conflicts with INTENT will be checked at resolution stage,
- see "resolve_fl_procedure". */
+ /* Conflicts with INTENT, SAVE and RESULT will be checked
+ at resolution stage, see "resolve_fl_procedure". */
if (attr->subroutine)
{
conf2 (target);
conf2 (allocatable);
- conf2 (result);
conf2 (in_namelist);
conf2 (dimension);
conf2 (function);