aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 4122c95..e183d90 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -4476,8 +4476,8 @@ load_commons (void)
static void
load_equiv (void)
{
- gfc_equiv *head, *tail, *end, *eq;
- bool unused;
+ gfc_equiv *head, *tail, *end, *eq, *equiv;
+ bool duplicate;
mio_lparen ();
in_load_equiv = true;
@@ -4504,23 +4504,19 @@ load_equiv (void)
mio_expr (&tail->expr);
}
- /* Unused equivalence members have a unique name. In addition, it
- must be checked that the symbols are from the same module. */
- unused = true;
- for (eq = head; eq; eq = eq->eq)
+ /* Check for duplicate equivalences being loaded from different modules */
+ duplicate = false;
+ for (equiv = gfc_current_ns->equiv; equiv; equiv = equiv->next)
{
- if (eq->expr->symtree->n.sym->module
- && head->expr->symtree->n.sym->module
- && strcmp (head->expr->symtree->n.sym->module,
- eq->expr->symtree->n.sym->module) == 0
- && !check_unique_name (eq->expr->symtree->name))
+ if (equiv->module && head->module
+ && strcmp (equiv->module, head->module) == 0)
{
- unused = false;
+ duplicate = true;
break;
}
}
- if (unused)
+ if (duplicate)
{
for (eq = head; eq; eq = head)
{