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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-28 
15:58:37 UTC ---
The following patch fixes the test case.


However, if one comments the "STOP 'Success'" line, one sees that there is
another bug (double free). The problem is that _copy does not properly do a
deep copy.

Expected: A deep copy of both attractor%state and
attractor%integrand%quadrature.

Currently:

__copy_lorenz_module_Lorenz
{
    *dst = *src;
        dst->integrand = src->integrand;
            __builtin_memcpy (dst->state.data, src->state.data, D.1953 * 4);

Thus, there is no deep copy of "attractor%integrand%quadrature"; thus, both
src->integrand->quadrature->_data and dst->integrand->quadrature->_data point
to the same memory, causing - for the example program - a segfault at the end
of the main program.



--- trans-stmt.c        (Revision 183664)
+++ trans-stmt.c        (Arbeitskopie)
@@ -4953 +4953,2 @@ gfc_trans_allocate (gfc_code * code)
-         if (expr->ts.type == BT_DERIVED &&
expr->ts.u.derived->attr.alloc_comp)
+         if (al->expr->ts.type == BT_DERIVED
+             && expr->ts.u.derived->attr.alloc_comp)

Reply via email to