aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2011-10-16 22:06:19 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2011-10-16 22:06:19 +0000
commit930d4d4e23ede3c1f2077aa926e4912058265078 (patch)
tree70c943f230ff04ba01f5685051e8b59fa8ff736f
parentbee64a2b9e0c63a3e731bba71c5e3c709204d288 (diff)
downloadgcc-930d4d4e23ede3c1f2077aa926e4912058265078.zip
gcc-930d4d4e23ede3c1f2077aa926e4912058265078.tar.gz
gcc-930d4d4e23ede3c1f2077aa926e4912058265078.tar.bz2
frontend-passes.c (current_ns): Make static.
2011-10-16 Thomas Koenig <tkoenig@gcc.gnu.org> * frontend-passes.c (current_ns): Make static. (create_var): Note parent of newly created namespace. (optimize_namespace): Don't wak sibling namespaces if they are EXEC_BLOCK because this is handled... (gfc_code_walker): ... here. Also walk ASSOCIATE lists. From-SVN: r180063
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/frontend-passes.c17
2 files changed, 23 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 6d7148d..1d515dc 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,11 @@
+2011-10-16 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ * frontend-passes.c (current_ns): Make static.
+ (create_var): Note parent of newly created namespace.
+ (optimize_namespace): Don't wak sibling namespaces
+ if they are EXEC_BLOCK because this is handled...
+ (gfc_code_walker): ... here. Also walk ASSOCIATE lists.
+
2011-10-16 Janus Weil <janus@gcc.gnu.org>
PR fortran/47023
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index dcbaf06..5b1a644 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -60,7 +60,7 @@ static gfc_code *inserted_block, **changed_statement;
/* The namespace we are currently dealing with. */
-gfc_namespace *current_ns;
+static gfc_namespace *current_ns;
/* If we are within any forall loop. */
@@ -261,6 +261,7 @@ create_var (gfc_expr * e)
(*current_code)->next = NULL;
/* Insert the BLOCK at the right position. */
*current_code = inserted_block;
+ ns->parent = current_ns;
}
else
ns = inserted_block->ext.block.ns;
@@ -509,8 +510,12 @@ optimize_namespace (gfc_namespace *ns)
gfc_code_walker (&ns->code, cfe_code, cfe_expr_0, NULL);
gfc_code_walker (&ns->code, optimize_code, optimize_expr, NULL);
+ /* BLOCKs are handled in the expression walker below. */
for (ns = ns->contained; ns; ns = ns->sibling)
- optimize_namespace (ns);
+ {
+ if (ns->code == NULL || ns->code->op != EXEC_BLOCK)
+ optimize_namespace (ns);
+ }
}
/* Replace code like
@@ -1143,6 +1148,7 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t codefn, walk_expr_fn_t exprfn,
gfc_code *b;
gfc_actual_arglist *a;
gfc_code *co;
+ gfc_association_list *alist;
/* There might be statement insertions before the current code,
which must not affect the expression walker. */
@@ -1151,6 +1157,13 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t codefn, walk_expr_fn_t exprfn,
switch (co->op)
{
+
+ case EXEC_BLOCK:
+ WALK_SUBCODE (co->ext.block.ns->code);
+ for (alist = co->ext.block.assoc; alist; alist = alist->next)
+ WALK_SUBEXPR (alist->target);
+ break;
+
case EXEC_DO:
WALK_SUBEXPR (co->ext.iterator->var);
WALK_SUBEXPR (co->ext.iterator->start);