This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/61831] [4.9/ 5 Regression] runtime error: pointer being freed was not allocated
- From: "mikael at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 23 Feb 2015 18:05:47 +0000
- Subject: [Bug fortran/61831] [4.9/ 5 Regression] runtime error: pointer being freed was not allocated
- Auto-submitted: auto-generated
- References: <bug-61831-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61831
--- Comment #42 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #41)
> My work patch is:
updated work patch below.
The testcase passes with it, at the price of leaking memory
Index: trans-expr.c
===================================================================
--- trans-expr.c (rÃvision 220717)
+++ trans-expr.c (copie de travail)
@@ -4949,7 +4949,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol *
if (e && (e->ts.type == BT_DERIVED || e->ts.type == BT_CLASS)
&& e->ts.u.derived->attr.alloc_comp
&& !(e->symtree && e->symtree->n.sym->attr.pointer)
- && (e->expr_type != EXPR_VARIABLE && !e->rank))
+ && (e->expr_type != EXPR_VARIABLE
+ && e->expr_type != EXPR_STRUCTURE && !e->rank))
{
int parm_rank;
tmp = build_fold_indirect_ref_loc (input_location,
@@ -7131,7 +7132,8 @@ gfc_conv_expr_reference (gfc_se * se, gfc_expr * e
if (expr->ts.type == BT_DERIVED && expr->rank
&& !gfc_is_finalizable (expr->ts.u.derived, NULL)
&& expr->ts.u.derived->attr.alloc_comp
- && expr->expr_type != EXPR_VARIABLE)
+ && expr->expr_type != EXPR_VARIABLE
+ && expr->expr_type != EXPR_ARRAY)
{
tree tmp;