+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
/* The namespace we are currently dealing with. */
-gfc_namespace *current_ns;
+static gfc_namespace *current_ns;
/* If we are within any forall loop. */
(*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;
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
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. */
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);