aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/class.c
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2018-12-08 18:09:05 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2018-12-08 18:09:05 +0000
commit4874b4d26c3ae78b69a51ab490bfba65d69e1323 (patch)
tree814a62bcd329a87fae9e3dad0f0e310a5bbba28b /gcc/fortran/class.c
parent47e1596cc1e877485483de1eca7b3eb4bd049cfb (diff)
downloadgcc-4874b4d26c3ae78b69a51ab490bfba65d69e1323.zip
gcc-4874b4d26c3ae78b69a51ab490bfba65d69e1323.tar.gz
gcc-4874b4d26c3ae78b69a51ab490bfba65d69e1323.tar.bz2
re PR fortran/88357 (ICE in parse_associate, at fortran/parse.c:4568)
2018-12-08 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88357 * class.c (insert_component_ref): Check for NULL pointer and previous error message issued. * parse.c (parse_associate): Check for NULL pointer. * resolve.c (resolve_assoc_var): Check for NULL pointer. 2018-12-08 Steven G. Kargl <kargl@gcc.gnu.org> * gfortran.dg/pr88357_1.f90: New test. * gfortran.dg/pr88357_2.f90: New test. From-SVN: r266908
Diffstat (limited to 'gcc/fortran/class.c')
-rw-r--r--gcc/fortran/class.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 2eae7f0..105511d 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -72,14 +72,18 @@ along with GCC; see the file COPYING3. If not see
static void
insert_component_ref (gfc_typespec *ts, gfc_ref **ref, const char * const name)
{
- gfc_symbol *type_sym;
gfc_ref *new_ref;
+ int wcnt, ecnt;
gcc_assert (ts->type == BT_DERIVED || ts->type == BT_CLASS);
- type_sym = ts->u.derived;
- gfc_find_component (type_sym, name, true, true, &new_ref);
+ gfc_find_component (ts->u.derived, name, true, true, &new_ref);
+
+ gfc_get_errors (&wcnt, &ecnt);
+ if (ecnt > 0 && !new_ref)
+ return;
gcc_assert (new_ref->u.c.component);
+
while (new_ref->next)
new_ref = new_ref->next;
new_ref->next = *ref;