written. */
static void mio_expr (gfc_expr **);
-static void mio_symbol_ref (gfc_symbol **);
+pointer_info *mio_symbol_ref (gfc_symbol **);
+pointer_info *mio_interface_rest (gfc_interface **);
static void mio_symtree_ref (gfc_symtree **);
/* Read or write an enumerated value. On writing, we return the input
/* Save or restore a reference to a symbol node. */
-void
+pointer_info *
mio_symbol_ref (gfc_symbol **symp)
{
pointer_info *p;
if (p->u.rsym.state == UNUSED)
p->u.rsym.state = NEEDED;
}
+ return p;
}
interfaces. Checking for duplicate and ambiguous interfaces has to
be done later when all symbols have been loaded. */
-static void
+pointer_info *
mio_interface_rest (gfc_interface **ip)
{
gfc_interface *tail, *p;
+ pointer_info *pi = NULL;
if (iomode == IO_OUTPUT)
{
p = gfc_get_interface ();
p->where = gfc_current_locus;
- mio_symbol_ref (&p->sym);
+ pi = mio_symbol_ref (&p->sym);
if (tail == NULL)
*ip = p;
}
mio_rparen ();
+ return pi;
}
const char *p;
char name[GFC_MAX_SYMBOL_LEN + 1], module[GFC_MAX_SYMBOL_LEN + 1];
gfc_user_op *uop;
+ pointer_info *pi = NULL;
+ int n, i;
mio_lparen ();
mio_internal_string (name);
mio_internal_string (module);
- /* Decide if we need to load this one or not. */
- p = find_use_name (name, true);
- if (p == NULL)
- {
- while (parse_atom () != ATOM_RPAREN);
- }
- else
+ n = number_use_names (name, true);
+ n = n ? n : 1;
+
+ for (i = 1; i <= n; i++)
{
- uop = gfc_get_uop (p);
- mio_interface_rest (&uop->operator);
+ /* Decide if we need to load this one or not. */
+ p = find_use_name_n (name, &i, true);
+
+ if (p == NULL)
+ {
+ while (parse_atom () != ATOM_RPAREN);
+ continue;
+ }
+
+ if (i == 1)
+ {
+ uop = gfc_get_uop (p);
+ pi = mio_interface_rest (&uop->operator);
+ }
+ else
+ {
+ if (gfc_find_uop (p, NULL))
+ continue;
+ uop = gfc_get_uop (p);
+ uop->operator = gfc_get_interface ();
+ uop->operator->where = gfc_current_locus;
+ add_fixup (pi->integer, &uop->operator->sym);
+ }
}
}
--- /dev/null
+! { dg-do run }
+module a
+ implicit none
+interface operator(.op.)
+ module procedure sub
+end interface
+interface operator(.ops.)
+ module procedure sub2
+end interface
+
+contains
+ function sub(i)
+ integer :: sub
+ integer,intent(in) :: i
+ sub = -i
+ end function sub
+ function sub2(i)
+ integer :: sub2
+ integer,intent(in) :: i
+ sub2 = i
+ end function sub2
+end module a
+
+program test
+use a, only: operator(.op.), operator(.op.), &
+operator(.my.)=>operator(.op.),operator(.ops.)=>operator(.op.)
+implicit none
+if (.my.2 /= -2 .or. .op.3 /= -3 .or. .ops.7 /= -7) call abort()
+end