aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-expr.c
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2017-06-15 23:17:48 +0200
committerJanus Weil <janus@gcc.gnu.org>2017-06-15 23:17:48 +0200
commitd0e7a9fdfc21c858d4131052cf38dea4fa8f44b2 (patch)
treec714a49a98e3543614a3e46469c23e577386d96d /gcc/fortran/trans-expr.c
parent0356a0749bed3e294fcee1ad1d47a1f681189e38 (diff)
downloadgcc-d0e7a9fdfc21c858d4131052cf38dea4fa8f44b2.zip
gcc-d0e7a9fdfc21c858d4131052cf38dea4fa8f44b2.tar.gz
gcc-d0e7a9fdfc21c858d4131052cf38dea4fa8f44b2.tar.bz2
re PR fortran/80983 ([F03] memory leak when calling procedure-pointer component with allocatable result)
2017-06-15 Janus Weil <janus@gcc.gnu.org> PR fortran/80983 * trans-expr.c (gfc_conv_procedure_call): Deallocate the result of scalar allocatable procedure-pointer components. 2017-06-15 Janus Weil <janus@gcc.gnu.org> PR fortran/80983 * gfortran.dg/proc_ptr_comp_51.f90: New test. From-SVN: r249227
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r--gcc/fortran/trans-expr.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 6af287e..acd0428 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -6132,7 +6132,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
after use. This necessitates the creation of a temporary to
hold the result to prevent duplicate calls. */
if (!byref && sym->ts.type != BT_CHARACTER
- && sym->attr.allocatable && !sym->attr.dimension && !comp)
+ && ((sym->attr.allocatable && !sym->attr.dimension && !comp)
+ || (comp && comp->attr.allocatable && !comp->attr.dimension)))
{
tmp = gfc_create_var (TREE_TYPE (se->expr), NULL);
gfc_add_modify (&se->pre, tmp, se->expr);