aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/check.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2012-01-23 21:38:23 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2012-01-23 21:38:23 +0100
commit048037281cf5e2a74fb28b7c638d355f362994f2 (patch)
treebc7fb0ccb25c6ce616bbf47c59ddb1672e9faef7 /gcc/fortran/check.c
parent8ae4c24b4c6f0b57eb0eda931d366b05103acf9b (diff)
downloadgcc-048037281cf5e2a74fb28b7c638d355f362994f2.zip
gcc-048037281cf5e2a74fb28b7c638d355f362994f2.tar.gz
gcc-048037281cf5e2a74fb28b7c638d355f362994f2.tar.bz2
re PR fortran/51948 ([OOP] Rejects valid: Function result value in MOVE_ALLOC, nested in SELECT TYPE)
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. From-SVN: r183453
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 cb6b94f..4b72a5fb 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);