This is the mail archive of the gcc-bugs@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]

[Bug fortran/61831] [4.9/ 4.10 Regression] runtime error: pointer being freed was not allocated


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61831

--- Comment #23 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Could you test the following patch?

--- ../_clean/gcc/fortran/trans-expr.c    2014-07-07 22:48:04.000000000 +0200
+++ gcc/fortran/trans-expr.c    2014-07-18 21:28:24.000000000 +0200
@@ -6512,7 +6512,10 @@ gfc_conv_expr_reference (gfc_se * se, gf
   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
+      || (expr->expr_type == EXPR_ARRAY
+          && expr->ts.u.derived->refs == 1)))
     {
       tree tmp;


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