PR fortran/45451
* trans-stmt.c (gfc_trans_allocate): Do a deep-copy for SOURCE=.
PR fortran/43018
* trans-array.c (duplicate_allocatable): Use size of type and not
the size of the pointer to the type.
2010-10-26 Tobias Burnus <burnus@net-b.de>
PR fortran/45451
* gfortran.dg/class_allocate_5.f90: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165936
138bc75d-0d04-0410-961f-
82ee72b054a4
+2010-10-26 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/45451
+ * trans-stmt.c (gfc_trans_allocate): Do a deep-copy for SOURCE=.
+
+ PR fortran/43018
+ * trans-array.c (duplicate_allocatable): Use size of type and not
+ the size of the pointer to the type.
+
2010-10-25 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/46140
null_data = gfc_finish_block (&block);
gfc_init_block (&block);
- size = TYPE_SIZE_UNIT (type);
+ size = TYPE_SIZE_UNIT (TREE_TYPE (type));
if (!no_malloc)
{
tmp = gfc_call_malloc (&block, type, size);
/* Initialization via SOURCE block
(or static default initializer). */
gfc_expr *rhs = gfc_copy_expr (code->expr3);
- if (al->expr->ts.type == BT_CLASS)
+ if (al->expr->ts.type == BT_CLASS && rhs->expr_type == EXPR_VARIABLE
+ && rhs->ts.type != BT_CLASS)
+ tmp = gfc_trans_assignment (expr, rhs, false, false);
+ else if (al->expr->ts.type == BT_CLASS)
{
+ /* TODO: One needs to do a deep-copy for BT_CLASS; cf. PR 46174. */
gfc_se dst,src;
if (rhs->ts.type == BT_CLASS)
gfc_add_component_ref (rhs, "$data");
+2010-10-26 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/45451
+ * gfortran.dg/class_allocate_5.f90: New.
+
2010-10-25 Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
Implement opaque-enum-specifiers for C++0x
--- /dev/null
+! { dg-do run }
+!
+! PR fortran/45451
+!
+! Contributed by Salvatore Filippone and Janus Weil
+!
+! Check that ALLOCATE with SOURCE= does a deep copy.
+!
+program bug23
+ implicit none
+
+ type :: psb_base_sparse_mat
+ integer, allocatable :: irp(:)
+ end type psb_base_sparse_mat
+
+ class(psb_base_sparse_mat), allocatable :: a
+ type(psb_base_sparse_mat) :: acsr
+
+ allocate(acsr%irp(4))
+ acsr%irp(1:4) = (/1,3,4,5/)
+
+ write(*,*) acsr%irp(:)
+
+ allocate(a,source=acsr)
+
+ write(*,*) a%irp(:)
+
+ call move_alloc(acsr%irp, a%irp)
+
+ write(*,*) a%irp(:)
+
+ if (any (a%irp /= [1,3,4,5])) call abort()
+end program bug23
+