Commit 03bd096b by Janus Weil

re PR fortran/37254 (Reject valid PROCEDURE statement with implicit interface)

2009-06-22  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/37254
	PR fortran/39850
	* interface.c (compare_parameter): Set implicit type for function
	actual arguments with BT_UNKNOWN.


2009-06-22  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/37254
	PR fortran/39850
	* gfortran.dg/interface_30.f90: Modified error message.
	* gfortran.dg/proc_decl_22.f90: New.

From-SVN: r148816
parent 34481f28
2009-06-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/37254
PR fortran/39850
* interface.c (compare_parameter): Set implicit type for function
actual arguments with BT_UNKNOWN.
2009-06-22 Tobias Burnus <burnus@net-b.de>
PR fortran/40472
......
......@@ -1407,9 +1407,14 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
}
if (formal->attr.function && !act_sym->attr.function)
gfc_add_function (&act_sym->attr, act_sym->name, &act_sym->declared_at);
if (formal->attr.subroutine && !act_sym->attr.subroutine)
{
gfc_add_function (&act_sym->attr, act_sym->name,
&act_sym->declared_at);
if (act_sym->ts.type == BT_UNKNOWN
&& gfc_set_default_type (act_sym, 1, act_sym->ns) == FAILURE)
return 0;
}
else if (formal->attr.subroutine && !act_sym->attr.subroutine)
gfc_add_subroutine (&act_sym->attr, act_sym->name,
&act_sym->declared_at);
......
2009-06-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/37254
PR fortran/39850
* gfortran.dg/interface_30.f90: Modified error message.
* gfortran.dg/proc_decl_22.f90: New.
2009-06-22 Ian Lance Taylor <iant@google.com>
* gcc.dg/Wcxx-compat-19.c: New testcase.
......
......@@ -15,9 +15,9 @@ program test
call sub1(func1)
call sub2(func2)
call sub1(func3)
call sub2(func3) ! { dg-error "Type mismatch in argument" }
call sub2(func3) ! { dg-error "is not a subroutine" }
call sub2(func4)
call sub1(func4) ! { dg-error "Interface mismatch in dummy procedure" }
call sub1(func4) ! { dg-error "is not a function" }
contains
subroutine sub1(a1)
interface
......
! { dg-do compile }
!
! PR 37254: Reject valid PROCEDURE statement with implicit interface
!
! Original test case by Dominique d'Humieres <dominiq@lps.ens.fr>
! Modified by Janus Weil <janus@gcc.gnu.org>
real function proc3( arg1 )
integer :: arg1
proc3 = arg1+7
end function proc3
program myProg
PROCEDURE () :: proc3
call proc4( proc3 )
contains
subroutine proc4( arg1 )
PROCEDURE(real) :: arg1
print*, 'the func: ', arg1(0)
end subroutine proc4
end program myProg
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