re PR fortran/71862 (ICE in gfc_add_component_ref, at fortran/class.c:241)

2016-07-22  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/71862
	* class.c: Remove assert.  Iterate over component only if non-null.

2016-07-22  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/71862
	* gfortran.dg/pr71862.f90: New test.

From-SVN: r238774
This commit is contained in:
Steven G. Kargl 2016-07-26 22:42:49 +00:00
parent 0d48446ff3
commit 9cd74e8fa8
4 changed files with 34 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2016-07-26 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/71862
* class.c: Remove assert. Iterate over component only if non-null.
2016-07-22 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/71935

View File

@ -238,12 +238,14 @@ gfc_add_component_ref (gfc_expr *e, const char *name)
/* Avoid losing memory. */
gfc_free_ref_list (*tail);
c = gfc_find_component (derived, name, true, true, tail);
gcc_assert (c);
for (ref = *tail; ref->next; ref = ref->next)
;
ref->next = next;
if (!next)
e->ts = c->ts;
if (c) {
for (ref = *tail; ref->next; ref = ref->next)
;
ref->next = next;
if (!next)
e->ts = c->ts;
}
}

View File

@ -1,3 +1,8 @@
2016-07-26 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/71862
* gfortran.dg/pr71862.f90: New test.
2016-07-26 Martin Sebor <msebor@redhat.com>
* gcc.dg/atomic/pr71675.c: Replace the unsupported c11 target

View File

@ -0,0 +1,16 @@
! { dg-do compile }
program p
type t
integer :: n = 0
integer, pointer :: q => null()
end type
type(t) :: x
print *, associated(x%q)
x = f()
print *, associated(x%q)
contains
function f() result (z) ! { dg-error "must be dummy, allocatable or pointer" }
class(t) :: z
print *, associated(z%q)
end
end