re PR fortran/77532 ([F03] ICE in check_dtio_interface1, at fortran/interface.c:4622)

2016-09-10  Paul Thomas  <pault@gcc.gnu.org>
	    Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/77532
	^ interface.c (check_dtio_arg_TKR_intent): Return after error.
	(check_dtio_interface1): Remove asserts, test for NULL and return
	if found.

	gfortran.dg/dtio_11.f90: new test.

Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org>

From-SVN: r240074
This commit is contained in:
Paul Thomas 2016-09-10 21:16:45 +00:00 committed by Jerry DeLisle
parent fb7c40dde3
commit 739d93391d
4 changed files with 65 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2016-09-10 Paul Thomas <pault@gcc.gnu.org>
Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77532
^ interface.c (check_dtio_arg_TKR_intent): Return after error.
(check_dtio_interface1): Remove asserts, test for NULL and return
if found.
2016-09-09 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77420

View File

@ -4559,8 +4559,11 @@ check_dtio_arg_TKR_intent (gfc_symbol *fsym, bool typebound, bt type,
int kind, int rank, sym_intent intent)
{
if (fsym->ts.type != type)
gfc_error ("DTIO dummy argument at %L must be of type %s",
&fsym->declared_at, gfc_basic_typename (type));
{
gfc_error ("DTIO dummy argument at %L must be of type %s",
&fsym->declared_at, gfc_basic_typename (type));
return;
}
if (fsym->ts.type != BT_CLASS && fsym->ts.type != BT_DERIVED
&& fsym->ts.kind != kind)
@ -4606,20 +4609,23 @@ check_dtio_interface1 (gfc_symbol *derived, gfc_symtree *tb_io_st,
{
/* Typebound DTIO binding. */
tb_io_proc = tb_io_st->n.tb;
gcc_assert (tb_io_proc != NULL);
if (tb_io_proc == NULL)
return;
gcc_assert (tb_io_proc->is_generic);
gcc_assert (tb_io_proc->u.generic->next == NULL);
specific_proc = tb_io_proc->u.generic->specific;
gcc_assert (!specific_proc->is_generic);
if (specific_proc == NULL || specific_proc->is_generic)
return;
dtio_sub = specific_proc->u.specific->n.sym;
}
else
{
generic_proc = tb_io_st->n.sym;
gcc_assert (generic_proc);
gcc_assert (generic_proc->generic);
if (generic_proc == NULL || generic_proc->generic == NULL)
return;
for (intr = tb_io_st->n.sym->generic; intr; intr = intr->next)
{

View File

@ -1,3 +1,9 @@
2016-09-10 Paul Thomas <pault@gcc.gnu.org>
Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77532
gfortran.dg/dtio_11.f90: new test.
2016-09-10 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77507

View File

@ -0,0 +1,39 @@
! { dg-do compile }
!
! Test fixes for PRs77532-4.
!
! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de>
!
! PR77532 - used to ICE
module m1
type t
end type
interface read(unformatted)
end interface
end
! PR77533 - used to ICE after error
module m2
type t
type(unknown), pointer :: next ! { dg-error "is a type that has not been declared" }
contains
procedure :: s
generic :: write(formatted) => s
end type
contains
subroutine s(x)
end
end
! PR77533 comment #1 - gave warning that
module m3
type t
contains
procedure :: s ! { dg-error "Non-polymorphic passed-object" }
generic :: write(formatted) => s
end type
contains
subroutine s(x) ! { dg-error "must be of type CLASS" }
class(t), intent(in) : x ! { dg-error "Invalid character in name" }
end
end