Commit 0ef5fbc1 by Paul Thomas

re PR fortran/68534 (No error on mismatch in number of arguments between…

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
parent 02718b32
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-25 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/68227
......@@ -68,7 +75,7 @@
* resolve.c (gfc_resolve_blocks): Handle EXEC_OACC_DECLARE.
* st.c (gfc_free_statement): Handle EXEC_OACC_DECLARE.
* symbol.c (check_conflict): Add conflict checks.
(gfc_add_oacc_declare_create, gfc_add_oacc_declare_copyin,
(gfc_add_oacc_declare_create, gfc_add_oacc_declare_copyin,
gfc_add_oacc_declare_deviceptr, gfc_add_oacc_declare_device_resident):
New functions.
(gfc_copy_attr): Handle new symbols.
......@@ -84,7 +91,7 @@
2015-11-21 Steven G. Kargl <kargl@gcc.gnu.org>
* simplify.c (gfc_simplify_cshift): Work around bootstrap issues
due to inappropriate warning options.
due to inappropriate warning options.
2015-11-21 Steven G. Kargl <kargl@gcc.gnu.org>
......@@ -93,7 +100,7 @@
(gfc_simplify_spread): Remove a FIXME and add error condition.
* intrinsic.h: Prototype for gfc_simplify_cshift
* intrinsic.c (add_functions): Use gfc_simplify_cshift.
2015-11-20 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/68237
......
......@@ -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;
......
2015-11-30 Paul Thomas <pault@gcc.gnu.org>
PR fortran/68534
* gfortran.dg/submodule_13.f08: New test.
2015-11-30 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* gcc.target/s390/load-relative-check.c: Add scan patterns for
......
! { dg-do compile }
!
! Checks the fix for PR68534 in which checks for the number
! failed if either the interface or the module procedure had
! no dummies.
!
! Reported on clf at:
! https://groups.google.com/forum/#!topic/comp.lang.fortran/-ZgbM5qkFmc
!
module m
implicit none
interface
module subroutine foo()
end subroutine foo
module subroutine bar(i)
integer, intent(inout) :: i
end subroutine bar
end interface
end module m
submodule(m) sm
contains
module subroutine foo(i) ! { dg-error "Mismatch in number of MODULE PROCEDURE formal" }
integer, intent(inout) :: i
i = 42
end subroutine foo
module subroutine bar ! { dg-error "Mismatch in number of MODULE PROCEDURE formal" }
print *, "bar"
end subroutine bar
end submodule sm
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment