http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45170
--- Comment #37 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-05-24 13:08:33 UTC --- (In reply to comment #36) > REMAINING issues: > - comment 24 first "Does not work.", see also comment 34 One has in gfc_trans_assignment_1: string_length = gfc_evaluate_now (rse.string_length, &rse.pre); ... if (...) gfc_add_block_to_block (&block, &rse.pre); where the (...) evaluates to false. (The call in gfc_trans_scalar_assign then works on rse->string_length, which seems seems to handle the gfc_add_block_to_block for rse.pre.) The following works, but I am not sure about the condition; I have the feeling that it could be handled unconditionally. --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -6893,3 +6897,2 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag, bool scalar_to_array; - bool def_clen_func; tree string_length; @@ -7012,9 +7015,4 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag, parameter available to the caller; gfortran saves it in the .mod files. */ - def_clen_func = (expr2->expr_type == EXPR_FUNCTION - || expr2->expr_type == EXPR_COMPCALL - || expr2->expr_type == EXPR_PPC); - if (gfc_option.flag_realloc_lhs - && expr2->ts.type == BT_CHARACTER - && (def_clen_func || expr2->expr_type == EXPR_OP) - && expr1->ts.deferred) + if (gfc_option.flag_realloc_lhs && expr2->ts.type == BT_CHARACTER + && expr1->ts.deferred) gfc_add_block_to_block (&block, &rse.pre);