This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
(i) An array constructor, used as an argument in the constructor of a structure with allocatable components, yielded incorrect bounds for the allocatable component. This manifests itself as memory leaks, bad accesses and segfaults at runtime (PR31320). (ii) The dependency between the rhs and lhs, where the lhs appears as a reference in its own constructor, led to an ICE because the array was deallocated at the start of the assignment.
The ChangeLog gives a description of the cure. Note that I took the opportunity to fix some whitespace problems, which makes the patch look more substantial than it actually is.
PR fortran/31320 PR fortran/32665 * trans-expr.c (gfc_trans_subcomponent_assign): Ensure that renormalization unity base is done independently of existing lbound value. (gfc_trans_scalar_assign): If rhs is not a variable, put lse->pre after rse->pre to ensure that de-allocation of lhs occurs after evaluation of rhs.
PR fortran/31320 PR fortran/32665 * gfortran.dg/alloc_comp_constructor_3.f90: New test.
Attachment:
pr32665.diff
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |