summaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-31 07:45:50 +0000
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-31 07:45:50 +0000
commit18ef5955099014622246796de686e2cbcb9e8bec (patch)
treedc1bbff7211de77af13ec23b2603163f0d6606c0 /gcc/fortran/module.c
parent796f6ddf517349e46196845a0d9ce5322495c4d0 (diff)
downloadgcc-18ef5955099014622246796de686e2cbcb9e8bec.tar.gz
2007-05-31 Paul Thomas <pault@gcc.gnu.org>
PR fortran/32103 * module.c (mio_symtree_ref): If an equivalence group member is not used, give it a hidden symbol and set the pointer_info. (load_equiv): Only free the equivalence if none of the members are used. 2007-05-31 Paul Thomas <pault@gcc.gnu.org> PR fortran/32103 * gfortran.dg/module_equivalence_3.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125216 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 8a650385597..132de385860 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -189,7 +189,7 @@ static gfc_use_rename *gfc_rename_list;
static pointer_info *pi_root;
static int symbol_number; /* Counter for assigning symbol numbers */
-/* Tells mio_expr_ref not to load unused equivalence members. */
+/* Tells mio_expr_ref to make symbols for unused equivalence members. */
static bool in_load_equiv;
@@ -2234,9 +2234,25 @@ mio_symtree_ref (gfc_symtree **stp)
require_atom (ATOM_INTEGER);
p = get_integer (atom_int);
- /* An unused equivalence member; bail out. */
+ /* An unused equivalence member; make a symbol and a symtree
+ for it. */
if (in_load_equiv && p->u.rsym.symtree == NULL)
- return;
+ {
+ /* Since this is not used, it must have a unique name. */
+ p->u.rsym.symtree = get_unique_symtree (gfc_current_ns);
+
+ /* Make the symbol. */
+ if (p->u.rsym.sym == NULL)
+ {
+ p->u.rsym.sym = gfc_new_symbol (p->u.rsym.true_name,
+ gfc_current_ns);
+ p->u.rsym.sym->module = gfc_get_string (p->u.rsym.module);
+ }
+
+ p->u.rsym.symtree->n.sym = p->u.rsym.sym;
+ p->u.rsym.symtree->n.sym->refs++;
+ p->u.rsym.referenced = 1;
+ }
if (p->type == P_UNKNOWN)
p->type = P_SYMBOL;
@@ -3206,13 +3222,13 @@ load_equiv (void)
mio_expr (&tail->expr);
}
- /* Unused variables have no symtree. */
- unused = false;
+ /* Unused equivalence members have a unique name. */
+ unused = true;
for (eq = head; eq; eq = eq->eq)
{
- if (!eq->expr->symtree)
+ if (!check_unique_name (eq->expr->symtree->name))
{
- unused = true;
+ unused = false;
break;
}
}