Commit 5f395580 by Janus Weil

re PR fortran/71894 ([OOP] ICE in gfc_add_component_ref, at fortran/class.c:227)

2016-11-09  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/71894
	* class.c (gfc_add_component_ref): Add safety checks to avoid ICE.

2016-11-09  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/71894
	* gfortran.dg/class_59.f90: New test.

From-SVN: r241993
parent 37b14185
2016-11-09 Janus Weil <janus@gcc.gnu.org>
PR fortran/71894
* class.c (gfc_add_component_ref): Add safety checks to avoid ICE.
2016-11-08 Janus Weil <janus@gcc.gnu.org> 2016-11-08 Janus Weil <janus@gcc.gnu.org>
PR fortran/68440 PR fortran/68440
......
...@@ -224,7 +224,8 @@ gfc_add_component_ref (gfc_expr *e, const char *name) ...@@ -224,7 +224,8 @@ gfc_add_component_ref (gfc_expr *e, const char *name)
break; break;
tail = &((*tail)->next); tail = &((*tail)->next);
} }
if (derived->components->next->ts.type == BT_DERIVED && if (derived->components && derived->components->next &&
derived->components->next->ts.type == BT_DERIVED &&
derived->components->next->ts.u.derived == NULL) derived->components->next->ts.u.derived == NULL)
{ {
/* Fix up missing vtype. */ /* Fix up missing vtype. */
......
2016-11-09 Janus Weil <janus@gcc.gnu.org>
PR fortran/71894
* gfortran.dg/class_59.f90: New test.
2016-11-09 Richard Biener <rguenther@suse.de> 2016-11-09 Richard Biener <rguenther@suse.de>
PR tree-optimization/78007 PR tree-optimization/78007
......
! { dg-do compile }
!
! PR 71894: [OOP] ICE in gfc_add_component_ref, at fortran/class.c:227
!
! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de>
subroutine s1
type t
integer :: n
end type
type(t) :: x
class(t) :: y ! { dg-error "must be dummy, allocatable or pointer" }
x = y
end
subroutine s2
type t
end type
class(t) :: x ! { dg-error "must be dummy, allocatable or pointer" }
class(t), allocatable :: y
select type (y)
type is (t)
y = x
end select
end
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