aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/class.c
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2016-07-26 22:42:49 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2016-07-26 22:42:49 +0000
commit9cd74e8fa89a528c779bbc9f31a2b362db9c12ec (patch)
tree3652c0abb2804401a42963631a45e70dce5f6d6c /gcc/fortran/class.c
parent0d48446ff30d6e0178f3d40bf1d20ea8ca19bd4c (diff)
downloadgcc-9cd74e8fa89a528c779bbc9f31a2b362db9c12ec.zip
gcc-9cd74e8fa89a528c779bbc9f31a2b362db9c12ec.tar.gz
gcc-9cd74e8fa89a528c779bbc9f31a2b362db9c12ec.tar.bz2
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
Diffstat (limited to 'gcc/fortran/class.c')
-rw-r--r--gcc/fortran/class.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index a627448..6d324a6 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -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;
+ }
}