Commit 46f19baf by Thomas Koenig

frontend-passes.c (gfc_expr_walker): Handle constructors and references.

2010-09-17  Thomas Koenig  <tkoenig@gcc.gnu.org>

	* frontend-passes.c (gfc_expr_walker):  Handle
	constructors and references.

From-SVN: r164403
parent 1389294c
2010-09-17 Thomas Koenig <tkoenig@gcc.gnu.org>
* frontend-passes.c (gfc_expr_walker): Handle
constructors and references.
2010-09-16 Tobias Burnus <burnus@net-b.de> 2010-09-16 Tobias Burnus <burnus@net-b.de>
PR fortran/43665 PR fortran/43665
......
...@@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "arith.h" #include "arith.h"
#include "flags.h" #include "flags.h"
#include "dependency.h" #include "dependency.h"
#include "constructor.h"
/* Forward declarations. */ /* Forward declarations. */
...@@ -319,6 +320,9 @@ gfc_expr_walker (gfc_expr **e, walk_expr_fn_t exprfn, void *data) ...@@ -319,6 +320,9 @@ gfc_expr_walker (gfc_expr **e, walk_expr_fn_t exprfn, void *data)
{ {
int walk_subtrees = 1; int walk_subtrees = 1;
gfc_actual_arglist *a; gfc_actual_arglist *a;
gfc_ref *r;
gfc_constructor *c;
int result = exprfn (e, &walk_subtrees, data); int result = exprfn (e, &walk_subtrees, data);
if (result) if (result)
return result; return result;
...@@ -339,6 +343,60 @@ gfc_expr_walker (gfc_expr **e, walk_expr_fn_t exprfn, void *data) ...@@ -339,6 +343,60 @@ gfc_expr_walker (gfc_expr **e, walk_expr_fn_t exprfn, void *data)
for (a = (*e)->value.compcall.actual; a; a = a->next) for (a = (*e)->value.compcall.actual; a; a = a->next)
WALK_SUBEXPR (a->expr); WALK_SUBEXPR (a->expr);
break; break;
case EXPR_STRUCTURE:
case EXPR_ARRAY:
for (c = gfc_constructor_first ((*e)->value.constructor); c;
c = gfc_constructor_next (c))
{
WALK_SUBEXPR (c->expr);
if (c->iterator != NULL)
{
WALK_SUBEXPR (c->iterator->var);
WALK_SUBEXPR (c->iterator->start);
WALK_SUBEXPR (c->iterator->end);
WALK_SUBEXPR (c->iterator->step);
}
}
if ((*e)->expr_type != EXPR_ARRAY)
break;
/* Fall through to the variable case in order to walk the
the reference. */
case EXPR_VARIABLE:
for (r = (*e)->ref; r; r = r->next)
{
gfc_array_ref *ar;
int i;
switch (r->type)
{
case REF_ARRAY:
ar = &r->u.ar;
if (ar->type == AR_SECTION || ar->type == AR_ELEMENT)
{
for (i=0; i< ar->dimen; i++)
{
WALK_SUBEXPR (ar->start[i]);
WALK_SUBEXPR (ar->end[i]);
WALK_SUBEXPR (ar->stride[i]);
}
}
break;
case REF_SUBSTRING:
WALK_SUBEXPR (r->u.ss.start);
WALK_SUBEXPR (r->u.ss.end);
break;
case REF_COMPONENT:
break;
}
}
default: default:
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment