https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81827

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|rguenth at gcc dot gnu.org         |pault at gcc dot gnu.org

--- Comment #8 from Paul Thomas <pault at gcc dot gnu.org> ---
I have taken a brief look at this but have to postpone completion of a fix for
a couple of weeks because I will be on vacation.

Index: ../trunk/gcc/fortran/trans-expr.c
===================================================================
*** ../trunk/gcc/fortran/trans-expr.c   (revision 250712)
--- ../trunk/gcc/fortran/trans-expr.c   (working copy)
*************** gfc_trans_assignment_1 (gfc_expr * expr1
*** 10075,10083 ****
      }
    else
      tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts,
!                                  gfc_expr_is_variable (expr2)
                                   || scalar_to_array
!                                  || expr2->expr_type == EXPR_ARRAY,
                                   !(l_is_temp || init_flag) && dealloc,
                                   expr1->symtree->n.sym->attr.codimension);
    /* Add the pre blocks to the body.  */
--- 10075,10086 ----
      }
    else
      tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts,
!                                  !(init_flag
!                                    && flag_coarray != GFC_FCOARRAY_LIB
!                                    && expr2->expr_type == EXPR_STRUCTURE)
!                                  && (gfc_expr_is_variable (expr2)
                                   || scalar_to_array
!                                  || expr2->expr_type == EXPR_ARRAY),
                                   !(l_is_temp || init_flag) && dealloc,
                                   expr1->symtree->n.sym->attr.codimension);
    /* Add the pre blocks to the body.  */

apart from a few regressions associated with tree dump counts of malloc.

The blanket exclusion of GFC_COARRAY_LIB is clearly not right.... or if it is,
I have not yet understood why.

I think that the problem lies in the default initializer for these derived
types. The suppression of the deep copy that the above patch provides can only
be necessary because the field in the initializer for the allocatable
components is not a null expression, as it should be. Otherwise, the deep copy
would stop dead in its tracks at the first level.

I have taken the bug.

Paul

Reply via email to