[Bug fortran/39879] [4.3/4.4/4.5 Regression] double free or corruption abort with gfortran

pault at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sun Apr 26 19:22:00 GMT 2009



------- Comment #9 from pault at gcc dot gnu dot org  2009-04-26 19:22 -------
(In reply to comment #8)
> I have an "obvious"  (ie. after three hours staring at it:-( ) fix that is

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c       (revision 146772)
+++ gcc/fortran/resolve.c       (working copy)
@@ -6645,7 +6645,8 @@
       if (rhs->expr_type == EXPR_VARIABLE
            && rhs->symtree->n.sym->ts.type == BT_DERIVED
            && has_default_initializer (rhs->symtree->n.sym->ts.derived)
-           && (lhs->symtree->n.sym == rhs->symtree->n.sym))
+           && (lhs->symtree->n.sym == rhs->symtree->n.sym)
+           && !(rhs->ref || lhs->ref))
         code->ext.actual->next->expr = gfc_get_parentheses (rhs);

       return true;

which regtests OK but I need a day or so to dwell on.  Although the above is my
doing, I do not recall for the life of me why a temporary had to be added in
this case.  I will attempt to recall that and figure out exactly which cases
are counter-indicated.

By the way, David, thanks for the report!

Paul


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39879



More information about the Gcc-bugs mailing list