re PR fortran/58355 ([F03] ICE with TYPE, EXTENDS before parent TYPE defined)

2013-09-23  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/58355
	* decl.c (check_extended_derived_type): Prevent segfault, modify error
	message.

2013-09-23  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/58355
	* gfortran.dg/extends_15.f90: New.

From-SVN: r202823
This commit is contained in:
Janus Weil 2013-09-23 09:40:39 +02:00
parent fb635b1123
commit 42e3d759b9
4 changed files with 32 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2013-09-23 Janus Weil <janus@gcc.gnu.org>
PR fortran/58355
* decl.c (check_extended_derived_type): Prevent segfault, modify error
message.
2013-09-20 Janus Weil <janus@gcc.gnu.org>
PR fortran/58099

View File

@ -7390,6 +7390,7 @@ syntax:
/* Check a derived type that is being extended. */
static gfc_symbol*
check_extended_derived_type (char *name)
{
@ -7401,14 +7402,15 @@ check_extended_derived_type (char *name)
return NULL;
}
extended = gfc_find_dt_in_generic (extended);
/* F08:C428. */
if (!extended)
{
gfc_error ("No such symbol in TYPE definition at %C");
gfc_error ("Symbol '%s' at %C has not been previously defined", name);
return NULL;
}
extended = gfc_find_dt_in_generic (extended);
if (extended->attr.flavor != FL_DERIVED)
{
gfc_error ("'%s' in EXTENDS expression at %C is not a "

View File

@ -1,3 +1,8 @@
2013-09-23 Janus Weil <janus@gcc.gnu.org>
PR fortran/58355
* gfortran.dg/extends_15.f90: New.
2013-09-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58481

View File

@ -0,0 +1,16 @@
! { dg-do compile }
!
! PR 58355: [4.7/4.8/4.9 Regression] [F03] ICE with TYPE, EXTENDS before parent TYPE defined
!
! Contributed by Andrew Benson <abensonca@gmail.com>
module ct
public :: t1
type, extends(t1) :: t2 ! { dg-error "has not been previously defined" }
type :: t1
end type
end
! { dg-final { cleanup-modules "ct" } }