aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/primary.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r--gcc/fortran/primary.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index c72f430..3a72dda 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -1709,7 +1709,6 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag)
gfc_ref *substring, *tail;
gfc_component *component;
gfc_symbol *sym = primary->symtree->n.sym;
- gfc_symtree *tbp;
match m;
bool unknown;
@@ -1754,6 +1753,7 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag)
for (;;)
{
gfc_try t;
+ gfc_symtree *tbp;
m = gfc_match_name (name);
if (m == MATCH_NO)
@@ -1772,13 +1772,20 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag)
gcc_assert (!tail || !tail->next);
gcc_assert (primary->expr_type == EXPR_VARIABLE);
- tbp_sym = tbp->typebound->target->n.sym;
+ if (tbp->typebound->is_generic)
+ tbp_sym = NULL;
+ else
+ tbp_sym = tbp->typebound->u.specific->n.sym;
primary->expr_type = EXPR_COMPCALL;
- primary->value.compcall.tbp = tbp;
- primary->ts = tbp_sym->ts;
-
- m = gfc_match_actual_arglist (tbp_sym->attr.subroutine,
+ primary->value.compcall.tbp = tbp->typebound;
+ primary->value.compcall.derived = sym;
+ primary->value.compcall.name = tbp->name;
+ gcc_assert (primary->symtree->n.sym->attr.referenced);
+ if (tbp_sym)
+ primary->ts = tbp_sym->ts;
+
+ m = gfc_match_actual_arglist (tbp->typebound->subroutine,
&primary->value.compcall.actual);
if (m == MATCH_ERROR)
return MATCH_ERROR;
@@ -1793,16 +1800,7 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag)
}
}
- if (sub_flag && !tbp_sym->attr.subroutine)
- {
- gfc_error ("'%s' at %C should be a SUBROUTINE", name);
- return MATCH_ERROR;
- }
- if (!sub_flag && !tbp_sym->attr.function)
- {
- gfc_error ("'%s' at %C should be a FUNCTION", name);
- return MATCH_ERROR;
- }
+ gfc_set_sym_referenced (tbp->n.sym);
break;
}