Commit 524cee40 by Paul Thomas

re PR fortran/88117 (ICE in gimplify_var_or_parm_decl, at gimplify.c:2697)

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/88117
	* gfortran.dg/deferred_character_32.f90 : New test

From-SVN: r269157
parent c2808389
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
PR fortran/89366
* decl.c (gfc_verify_c_interop_param): Restriction on string
......
......@@ -11166,6 +11166,9 @@ deferred_op_assign (gfc_code **code, gfc_namespace *ns)
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;
......
......@@ -10579,7 +10579,9 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
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
* gfortran.dg/ISO_Fortran_binding_1.f90 : Correct test for
previously incorrect lbound for allocatable expressions. Also
......
! { 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment