This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[Patch, fortran] PR67177, 67977 and memory leaks in move_alloc


Dear All,

I was moved by a report on clf of memory leaks in move_alloc to
investigate the cause. This turned out to be trivial but led to the
above PRs, which themselves were trivial. The result is the attached
patch. I am aware that I have not investigated the further
ramifications that I can imagine are there. Rather, I thought just to
fix the reported problems.

It should be noted that there is no PR directly associated with the
memory leaks. Since the standard does not require this, I did not
think that it was worthwhile to raise a PR and then close it!

Bootstraps and regtests on FC21/x86_64 - OK for trunk? ... and 5.2
after a decent interval?

Cheers

Paul

2015-10-17  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/67177
    PR fortran/67977
    * primary.c (match_substring): Add an argument 'deferred' to
    flag that a substring reference with null start and end should
    not be optimized away for deferred length strings.
    (match_string_constant, gfc_match_rvalue): Set the argument.
    * trans-expr.c (alloc_scalar_allocatable_for_assignment): If
    there is a substring reference return.
    * trans-intrinsic.c (conv_intrinsic_move_alloc): For deferred
    characters, assign the 'from' string length to the 'to' string
    length. If the 'from' expression is deferred, set its string
    length to zero. If the 'to' expression has allocatable
    components, deallocate them.

2015-10-17  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/67177
    * gfortran.dg/move_alloc_15.f90: New test
    * gfortran.dg/move_alloc_16.f90: New test

    PR fortran/67977
    * gfortran.dg/deferred_character_assignment_1.f90: New test

Attachment: submit.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]