summaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-array.h
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2010-01-14 06:17:38 +0000
committerPaul Thomas <pault@gcc.gnu.org>2010-01-14 06:17:38 +0000
commit40c3294835c9e8e416c0eae4688c1160ffc8ad3f (patch)
tree00205ae58b6e5ce1f062de0463815660141dcdc6 /gcc/fortran/trans-array.h
parent08b02036337225eb9b58497c704efaa2b41918bc (diff)
downloadgcc-40c3294835c9e8e416c0eae4688c1160ffc8ad3f.tar.gz
re PR fortran/41478 (Corrupted memory using PACK for derived-types with allocated components)
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. From-SVN: r155877
Diffstat (limited to 'gcc/fortran/trans-array.h')
-rw-r--r--gcc/fortran/trans-array.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h
index 175b3c60ff5..6807fcbe612 100644
--- a/gcc/fortran/trans-array.h
+++ b/gcc/fortran/trans-array.h
@@ -45,7 +45,9 @@ tree gfc_trans_g77_array (gfc_symbol *, tree);
/* Generate code to deallocate an array, if it is allocated. */
tree gfc_trans_dealloc_allocated (tree);
-tree gfc_duplicate_allocatable(tree dest, tree src, tree type, int rank);
+tree gfc_duplicate_allocatable (tree dest, tree src, tree type, int rank);
+
+tree gfc_copy_allocatable_data (tree dest, tree src, tree type, int rank);
tree gfc_nullify_alloc_comp (gfc_symbol *, tree, int);
@@ -53,6 +55,8 @@ tree gfc_deallocate_alloc_comp (gfc_symbol *, tree, int);
tree gfc_copy_alloc_comp (gfc_symbol *, tree, tree, int);
+tree gfc_copy_only_alloc_comp (gfc_symbol *, tree, tree, int);
+
/* Add initialization for deferred arrays. */
tree gfc_trans_deferred_array (gfc_symbol *, tree);
/* Generate an initializer for a static pointer or allocatable array. */