summaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/trans-common.c')
-rw-r--r--gcc/fortran/trans-common.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index 5d72a5086bc..3b34b334c2c 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -122,6 +122,7 @@ typedef struct segment_info
static segment_info * current_segment;
static gfc_namespace *gfc_common_ns = NULL;
+
/* Make a segment_info based on a symbol. */
static segment_info *
@@ -144,6 +145,34 @@ get_segment_info (gfc_symbol * sym, HOST_WIDE_INT offset)
return s;
}
+
+/* Add a copy of a segment list to the namespace. This is specifically for
+ equivalence segments, so that dependency checking can be done on
+ equivalence group members. */
+
+static void
+copy_equiv_list_to_ns (segment_info *c)
+{
+ segment_info *f;
+ gfc_equiv_info *s;
+ gfc_equiv_list *l;
+
+ l = (gfc_equiv_list *) gfc_getmem (sizeof (gfc_equiv_list));
+
+ l->next = c->sym->ns->equiv_lists;
+ c->sym->ns->equiv_lists = l;
+
+ for (f = c; f; f = f->next)
+ {
+ s = (gfc_equiv_info *) gfc_getmem (sizeof (gfc_equiv_info));
+ s->next = l->equiv;
+ l->equiv = s;
+ s->sym = f->sym;
+ s->offset = f->offset;
+ }
+}
+
+
/* Add combine segment V and segment LIST. */
static segment_info *
@@ -787,6 +816,9 @@ add_equivalences (bool *saw_equiv)
}
}
}
+
+ /* Add a copy of this segment list to the namespace. */
+ copy_equiv_list_to_ns (current_segment);
}