* trans-array.c (gfc_trans_scalarizing_loops): Skip clearing if a
parent exists.
* trans-expr.c (gfc_advance_se_ss_chain): Move to parent ss at the
end of the chain.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180889
138bc75d-0d04-0410-961f-
82ee72b054a4
2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+ * trans.h (struct gfc_ss): New field parent.
+ * trans-array.c (gfc_trans_scalarizing_loops): Skip clearing if a
+ parent exists.
+ * trans-expr.c (gfc_advance_se_ss_chain): Move to parent ss at the
+ end of the chain.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
* trans-array.h (gfc_trans_create_temp_array): Remove loop argument.
* trans-array.c (gfc_trans_create_temp_array): Ditto. Get loop from ss.
Update reference to loop. Remove loop argument.
/* Clear all the used flags. */
for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain)
- ss->info->useflags = 0;
+ if (ss->parent == NULL)
+ ss->info->useflags = 0;
}
gfc_advance_se_ss_chain (gfc_se * se)
{
gfc_se *p;
+ gfc_ss *ss;
gcc_assert (se != NULL && se->ss != NULL && se->ss != gfc_ss_terminator);
/* Simple consistency check. */
gcc_assert (p->parent == NULL || p->parent->ss == p->ss);
- p->ss = p->ss->next;
+ /* If we were in a nested loop, the next scalarized expression can be
+ on the parent ss' next pointer. Thus we should not take the next
+ pointer blindly, but rather go up one nest level as long as next
+ is the end of chain. */
+ ss = p->ss;
+ while (ss->next == gfc_ss_terminator && ss->parent != NULL)
+ ss = ss->parent;
+
+ p->ss = ss->next;
p = p->parent;
}
struct gfc_ss *loop_chain;
struct gfc_ss *next;
+ /* Non-null if the ss is part of a nested loop. */
+ struct gfc_ss *parent;
+
/* The loop this gfc_ss is in. */
struct gfc_loopinfo *loop;