[multiple changes]

2016-01-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/69397
	PR fortran/68442
	* interface.c (gfc_arglist_matches_symbol): Replace assert with
	a return false if not a procedure.
	* resolve.c (resolve_generic_f): Test if we are resolving an
	initialization expression and adjust error message accordingly.

2016-01-24  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/69397
	PR fortran/68442
	* gfortran.dg/interface_38.f90: New test.
	* gfortran.dg/interface_39.f90: New test.

From-SVN: r232780
This commit is contained in:
Jerry DeLisle 2016-01-24 22:18:20 +00:00
parent a220f43d11
commit 1d10121630
6 changed files with 55 additions and 3 deletions

View file

@ -1,3 +1,12 @@
2016-01-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/69397
PR fortran/68442
* interface.c (gfc_arglist_matches_symbol): Replace assert with
a return false if not a procedure.
* resolve.c (resolve_generic_f): Test if we are resolving an
initialization expression and adjust error message accordingly.
2016-01-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/66094

View file

@ -3506,7 +3506,8 @@ gfc_arglist_matches_symbol (gfc_actual_arglist** args, gfc_symbol* sym)
gfc_formal_arglist *dummy_args;
bool r;
gcc_assert (sym->attr.flavor == FL_PROCEDURE);
if (sym->attr.flavor != FL_PROCEDURE)
return false;
dummy_args = gfc_sym_get_dummy_args (sym);

View file

@ -2565,8 +2565,13 @@ generic:
that possesses a matching interface. 14.1.2.4 */
if (sym && !intr && !gfc_is_intrinsic (sym, 0, expr->where))
{
gfc_error ("There is no specific function for the generic %qs "
"at %L", expr->symtree->n.sym->name, &expr->where);
if (gfc_init_expr_flag)
gfc_error ("Function %qs in initialization expression at %L "
"must be an intrinsic function",
expr->symtree->n.sym->name, &expr->where);
else
gfc_error ("There is no specific function for the generic %qs "
"at %L", expr->symtree->n.sym->name, &expr->where);
return false;
}

View file

@ -1,3 +1,10 @@
2016-01-24 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/69397
PR fortran/68442
* gfortran.dg/interface_38.f90: New test.
* gfortran.dg/interface_39.f90: New test.
2016-01-24 Patrick Palka <ppalka@gcc.gnu.org>
Revert:

View file

@ -0,0 +1,16 @@
! { dg-do compile }
! PR69397
program p
interface f
procedure f1 ! { dg-error "neither function nor subroutine" }
!... more
end interface
integer, allocatable :: z
print *, f(z) ! { dg-error "no specific function" }
contains
integer function f2 (x)
integer, allocatable :: x
f2 = 1
end
end

View file

@ -0,0 +1,14 @@
! { dg-do compile }
! PR68442
module m
interface gkind
procedure g
end interface
contains
subroutine f(x)
character(kind=gkind()) :: x ! { dg-error "must be an intrinsic" }
end
integer function g()
g = 1
end
end