aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2015-11-30 13:33:27 +0000
committerPaul Thomas <pault@gcc.gnu.org>2015-11-30 13:33:27 +0000
commit0ef5fbc1f4b4e34e4b084f5b59b0885bfa3300fb (patch)
tree2b2cbae4d77a9f7243f7234671539d7495c7eb42 /gcc/fortran/decl.c
parent02718b323ba585f41a34e4202c9ca5ba1b3aa321 (diff)
downloadgcc-0ef5fbc1f4b4e34e4b084f5b59b0885bfa3300fb.zip
gcc-0ef5fbc1f4b4e34e4b084f5b59b0885bfa3300fb.tar.gz
gcc-0ef5fbc1f4b4e34e4b084f5b59b0885bfa3300fb.tar.bz2
re PR fortran/68534 (No error on mismatch in number of arguments between submodule and module interface)
2015-11-30 Paul Thomas <pault@gcc.gnu.org> PR fortran/68534 * decl.c (gfc_match_formal_arglist): Cope with zero formal args either in interface declaration or in procedure declaration in submodule. 2015-11-30 Paul Thomas <pault@gcc.gnu.org> PR fortran/68534 * gfortran.dg/submodule_13.f08: New test. From-SVN: r231072
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;