+2019-03-17 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/88008
+ * gfortran.h (expr_t): Add EXPR_UNKNOWN.
+ * expr.c (gfc_copy_expr): Add EXPR_UNKNOWN to switch statement.
+ (gfc_simplify_expr): Likewise.
+ * module.c (mio_expr): Likewise.
+ * resovle.c (extract_compcall_passed_object): Issue error on
+ unknown type.
+ (check_typebound_baseobject): Issue error on wrong type.
+ * trans-expr.c (gfc_apply_interface_mapping_to_expr): Add
+ EXPR_UNKNOWN to switch statement.
+
2019-03-16 Jakub Jelinek <jakub@redhat.com>
PR fortran/89724
case EXPR_VARIABLE:
case EXPR_NULL:
break;
+
+ case EXPR_UNKNOWN:
+ gcc_unreachable ();
}
q->shape = gfc_copy_shape (p->shape, p->rank);
case EXPR_COMPCALL:
case EXPR_PPC:
break;
+
+ case EXPR_UNKNOWN:
+ gcc_unreachable ();
}
return true;
/* Expression node types. */
enum expr_t
-{ EXPR_OP = 1, EXPR_FUNCTION, EXPR_CONSTANT, EXPR_VARIABLE,
+ { EXPR_UNKNOWN = 0, EXPR_OP = 1, EXPR_FUNCTION, EXPR_CONSTANT, EXPR_VARIABLE,
EXPR_SUBSTRING, EXPR_STRUCTURE, EXPR_ARRAY, EXPR_NULL, EXPR_COMPCALL, EXPR_PPC
};
case EXPR_COMPCALL:
case EXPR_PPC:
+ case EXPR_UNKNOWN:
gcc_unreachable ();
break;
}
{
gfc_expr* po;
+ if (e->expr_type == EXPR_UNKNOWN)
+ {
+ gfc_error ("Error in typebound call at %L",
+ &e->where);
+ return NULL;
+ }
+
gcc_assert (e->expr_type == EXPR_COMPCALL);
if (e->value.compcall.base_object)
if (!base)
return false;
- gcc_assert (base->ts.type == BT_DERIVED || base->ts.type == BT_CLASS);
+ if (base->ts.type != BT_DERIVED && base->ts.type != BT_CLASS)
+ {
+ gfc_error ("Error in typebound call at %L", &e->where);
+ goto cleanup;
+ }
if (base->ts.type == BT_CLASS && !gfc_expr_attr (base).class_ok)
return false;
case EXPR_COMPCALL:
case EXPR_PPC:
+ case EXPR_UNKNOWN:
gcc_unreachable ();
break;
}
+2019-03-17 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/88008
+ * gfortran.dg/typebound_call_31.f90: New test.
+
2019-03-03-17 John David Anglin <danglin@gcc.gnu.org>
* gcc.dg/compat/pr83487-1_x.c: Use -fno-common option on hppa*-*-hpux*.
--- /dev/null
+! { dg-do compile }
+! PR 88008 - this use to ICE. Original test case by
+! Gerhard Steinmetz.
+
+module m
+ type t
+ integer, pointer :: z
+ contains
+ procedure :: g
+ end type
+contains
+ subroutine g(x)
+ class(t) :: x
+ call x%z%g() ! { dg-error "Error in typebound call" }
+ end
+end