+2019-02-23 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/88117
+ * resolve.c (deferred_op_assign): Return if the lhs expression
+ has the pointer attribute.
+ * trans-expr.c (gfc_trans_assignment_1): Do not fix the string
+ length if the lhs expression has the pointer attribute.
+
2019-02-23 Paul Thomas <pault@gcc.gnu.org>
PR fortran/89385
if (!gfc_check_dependency ((*code)->expr1, (*code)->expr2, 1))
return false;
+ if (gfc_expr_attr ((*code)->expr1).pointer)
+ return false;
+
tmp_expr = get_temp_from_expr ((*code)->expr1, ns);
tmp_expr->where = (*code)->loc;
string_length = gfc_evaluate_now (rse.string_length, &rse.pre);
else if (expr2->ts.type == BT_CHARACTER)
{
- if (expr1->ts.deferred && gfc_check_dependency (expr1, expr2, true))
+ if (expr1->ts.deferred
+ && gfc_expr_attr (expr1).allocatable
+ && gfc_check_dependency (expr1, expr2, true))
rse.string_length = gfc_evaluate_now (rse.string_length, &rse.pre);
string_length = rse.string_length;
}
+2019-02-23 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/88117
+ * gfortran.dg/deferred_character_32.f90 : New test
+
2019-02-23 Paul Thomas <pault@gcc.gnu.org>
PR fortran/89385
--- /dev/null
+! { dg-do run }
+!
+! Test the fix for PR88117.
+!
+! Contributed by Gerhard Steinmetz <gscfq@t-online.de>
+!
+program p
+ character(:), pointer :: z(:)
+ allocate (z, source = ['abcd', 'bcde'])
+ z = (z) ! gimplifier choked here.
+ if (any (z .ne. ['abcd', 'bcde'])) stop 1
+ deallocate (z)
+end