This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/41478] Corrupted memory using PACK for derived-types with allocated components
- From: "pault at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Jan 2010 06:17:51 -0000
- Subject: [Bug fortran/41478] Corrupted memory using PACK for derived-types with allocated components
- References: <bug-41478-15192@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #27 from pault at gcc dot gnu dot org 2010-01-14 06:17 -------
Subject: Bug 41478
Author: pault
Date: Thu Jan 14 06:17:38 2010
New Revision: 155877
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155877
Log:
2010-01-14 Paul Thomas <pault@gcc.gnu.org>
PR fortran/41478
* trans-array.c (duplicate_allocatable): Static version of
gfc_duplicate_allocatable with provision to handle scalar
components. New boolean argument to switch off call to malloc
if true.
(gfc_duplicate_allocatable): New function to call above with
new argument false.
(gfc_copy_allocatable_data): New function to call above with
new argument true.
(structure_alloc_comps): Do not apply indirect reference to
scalar pointers. Add new section to copy allocatable components
of arrays. Extend copying of allocatable components to include
scalars.
(gfc_copy_only_alloc_comp): New function to copy allocatable
component derived types, without allocating the base structure.
* trans-array.h : Add primitive for gfc_copy_allocatable_data.
Add primitive for gfc_copy_only_alloc_comp.
* trans-expr.c (gfc_conv_procedure_call): After calls to
transformational functions with results that are derived types
with allocatable components, copy the components in the result.
(gfc_trans_arrayfunc_assign): Deallocate allocatable components
of lhs derived types before allocation.
2010-01-14 Paul Thomas <pault@gcc.gnu.org>
PR fortran/41478
* gfortran.dg/alloc_comp_scalar_1.f90: New test.
* gfortran.dg/alloc_comp_transformational_1.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/alloc_comp_scalar_1.f90
trunk/gcc/testsuite/gfortran.dg/alloc_comp_transformational_1.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-array.c
trunk/gcc/fortran/trans-array.h
trunk/gcc/fortran/trans-expr.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41478