From 575b527e5798ecbf5d36974bae2c87974019fefd Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Sat, 28 Oct 2017 08:49:26 +0000 Subject: re PR fortran/81758 ([OOP] Broken vtab) 2017-10-28 Paul Thomas PR fortran/81758 * trans-expr.c (trans_class_vptr_len_assignment): 'vptr_expr' must only be set if the right hand side expression is of type class. 2017-10-28 Paul Thomas PR fortran/81758 * gfortran.dg/class_63.f90: New test. From-SVN: r254195 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/trans-expr.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a871fc2..7ad2427 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2017-10-28 Paul Thomas + + PR fortran/81758 + * trans-expr.c (trans_class_vptr_len_assignment): 'vptr_expr' + must only be set if the right hand side expression is of type + class. + 2017-10-27 Steven G. Kargl PR fortran/82620 diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 4e8bfc5..71ec176 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -8053,7 +8053,7 @@ trans_class_vptr_len_assignment (stmtblock_t *block, gfc_expr * le, { /* Get the vptr from the rhs expression only, when it is variable. Functions are expected to be assigned to a temporary beforehand. */ - vptr_expr = re->expr_type == EXPR_VARIABLE + vptr_expr = (re->expr_type == EXPR_VARIABLE && re->ts.type == BT_CLASS) ? gfc_find_and_cut_at_last_class_ref (re) : NULL; if (vptr_expr != NULL && vptr_expr->ts.type == BT_CLASS) -- cgit v1.1