+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-07 Jakub Jelinek <jakub@redhat.com>
PR fortran/88377
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;
else
rank = a->target->rank;
/* When the rank is greater than zero then sym will be an array. */
- if (sym->ts.type == BT_CLASS)
+ if (sym->ts.type == BT_CLASS && CLASS_DATA (sym))
{
if ((!CLASS_DATA (sym)->as && rank != 0)
|| (CLASS_DATA (sym)->as
{
/* target's rank is 0, but the type of the sym is still array valued,
which has to be corrected. */
- if (sym->ts.type == BT_CLASS && CLASS_DATA (sym)->as)
+ if (sym->ts.type == BT_CLASS
+ && CLASS_DATA (sym) && CLASS_DATA (sym)->as)
{
gfc_array_spec *as;
symbol_attribute attr;
+2018-12-08 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ * gfortran.dg/pr88357_1.f90: New test.
+ * gfortran.dg/pr88357_2.f90: New test.
+
2018-12-08 Jakub Jelinek <jakub@redhat.com>
PR fortran/88304
--- /dev/null
+! { dg-do compile }
+! { dg-options "-fcoarray=single" }
+program p
+ type t
+ end type
+ class(t) :: x[*] ! { dg-error "must be dummy, allocatable or pointer" }
+ associate (y => x)
+ end associate
+end
--- /dev/null
+! { dg-do compile }
+program p
+ type t
+ end type
+ class(t) :: x ! { dg-error "must be dummy, allocatable or pointer" }
+ associate (y => x)
+ end associate
+end