This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, fortran] PR78293 - - [5/6/7 Regression] SIGABRT with function result used as argument
- From: Andre Vehreschild <vehre at gmx dot de>
- To: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- Cc: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 25 Nov 2016 13:00:22 +0100
- Subject: Re: [Patch, fortran] PR78293 - - [5/6/7 Regression] SIGABRT with function result used as argument
- Authentication-results: sourceware.org; auth=none
- References: <CAGkQGi+cXQChz-gz8=-cgv7xYp7HxxTuAq8J6146o_muZ=JUgQ@mail.gmail.com>
Hi Thomas,
> Andre put me to shame with a devastatingly simple replacement for a
> horribly complicated and wrong patch that I was getting into.
I did not mean to. I happened to work in the same area and the PR's description
rang a whole chorus of bells what might have been going wrong.
> The part of the patch in trans-expr.c fixes the PR and the part in
> trans-stmt.c fixes a memory leak in function 'tt'. This latter fixes
I propose to change the comment in the second chunk (trans-stmt.c) from:
- /* Deallocate any allocatable components after all the allocations
- and assignments of expr3 have been completed. */
to
+ /* Deallocate any allocatable components in expressions that use a
+ temporary, i.e. are not of expr-type EXPR_VARIABLE or force the
+ use of a temporary, after the assignment of expr3 is completed. */
Mind that the indentation is corrupted by my mailer. Please polish the comment
a bit. It feels awkward.
> half of the memory leaks in class_array_15.f03. I have noted the rest
> of this problem in PR38319 with which it is associated.
>
> Bootstraps and regtests on FC21/x86_64 - OK for trunk and, later
> 5-branch and 6-branch?
Ok'ing a patch I participated in writing does not feel correct. So not doing it.
When committing please add yourself also to the Changelog in gcc/fortran to
prevent confusion when this patch causes regressions. You are as much
responsible for fixing it as me.
Regards,
Andre
> Cheers
>
> Paul
>
> 2016-11-24 Andre Vehreschild <vehre@gcc.gnu.org>
>
> PR fortran/78293
> * trans-expr.c (gfc_conv_procedure_call): Prepend deallocation
> of alloctable components to post, rather than adding to
> se->post.
> * trans-stmt.c (gfc_trans_allocate): Move deallocation of expr3
> allocatable components so that all expr3s are visited.
>
> 2016-11-24 Paul Thomas <pault@gcc.gnu.org>
>
> PR fortran/78293
> * gfortran.dg/allocatable_function_10.f90: New test.
> * gfortran.dg/class_array_15.f03: Increase builtin_free count
> from 11 to 12.
--
Andre Vehreschild * Email: vehre ad gmx dot de