summaryrefslogtreecommitdiff
path: root/gcc/fortran/check.c
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-01-23 20:38:23 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-01-23 20:38:23 +0000
commitebb074aff2cb5e6c434a5c3c44fbd8f239f6f175 (patch)
treebc7fb0ccb25c6ce616bbf47c59ddb1672e9faef7 /gcc/fortran/check.c
parent33eefbca6ea392fd7c4f823d364fbc1a4c4736f8 (diff)
downloadgcc-ebb074aff2cb5e6c434a5c3c44fbd8f239f6f175.tar.gz
2012-01-23 Tobias Burnus <burnus@net-b.de>
PR fortran/51948 * check.c (variable_check): Fix checking for result variables and deeply nested BLOCKs. 2012-01-23 Tobias Burnus <burnus@net-b.de> PR fortran/51948 * gfortran.dg/move_alloc_12.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183453 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/check.c')
-rw-r--r--gcc/fortran/check.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index cb6b94f7f18..4b72a5fb0b3 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -521,15 +521,18 @@ variable_check (gfc_expr *e, int n, bool allow_proc)
if (e->expr_type == EXPR_VARIABLE
&& e->symtree->n.sym->attr.flavor != FL_PARAMETER
- && (allow_proc
- || !e->symtree->n.sym->attr.function
- || (e->symtree->n.sym == e->symtree->n.sym->result
- && (e->symtree->n.sym == gfc_current_ns->proc_name
- || (gfc_current_ns->parent
- && e->symtree->n.sym
- == gfc_current_ns->parent->proc_name)))))
+ && (allow_proc || !e->symtree->n.sym->attr.function))
return SUCCESS;
+ if (e->expr_type == EXPR_VARIABLE && e->symtree->n.sym->attr.function
+ && e->symtree->n.sym == e->symtree->n.sym->result)
+ {
+ gfc_namespace *ns;
+ for (ns = gfc_current_ns; ns; ns = ns->parent)
+ if (ns->proc_name == e->symtree->n.sym)
+ return SUCCESS;
+ }
+
gfc_error ("'%s' argument of '%s' intrinsic at %L must be a variable",
gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic, &e->where);