aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r--gcc/fortran/decl.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index c4ce18b..10a08e0 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -4817,14 +4817,23 @@ ok:
goto cleanup;
}
- if (formal)
+ if (progname->attr.module_procedure && progname->attr.host_assoc)
{
+ bool arg_count_mismatch = false;
+
+ if (!formal && head)
+ arg_count_mismatch = true;
+
+ /* Abbreviated module procedure declaration is not meant to have any
+ formal arguments! */
+ if (!sym->abr_modproc_decl && formal && !head)
+ arg_count_mismatch = true;
+
for (p = formal, q = head; p && q; p = p->next, q = q->next)
{
if ((p->next != NULL && q->next == NULL)
|| (p->next == NULL && q->next != NULL))
- gfc_error_now ("Mismatch in number of MODULE PROCEDURE "
- "formal arguments at %C");
+ arg_count_mismatch = true;
else if ((p->sym == NULL && q->sym == NULL)
|| strcmp (p->sym->name, q->sym->name) == 0)
continue;
@@ -4833,6 +4842,10 @@ ok:
"argument names (%s/%s) at %C",
p->sym->name, q->sym->name);
}
+
+ if (arg_count_mismatch)
+ gfc_error_now ("Mismatch in number of MODULE PROCEDURE "
+ "formal arguments at %C");
}
return MATCH_YES;