gfc_build_addr_expr (NULL_TREE, dest_tok),
NULL_TREE, NULL_TREE, NULL_TREE,
GFC_CAF_COARRAY_ALLOC_REGISTER_ONLY);
+ gfc_add_modify (&block, dest, gfc_conv_descriptor_data_get (dummy_desc));
null_data = gfc_finish_block (&block);
gfc_init_block (&block);
gfc_build_addr_expr (NULL_TREE, dest_tok),
NULL_TREE, NULL_TREE, NULL_TREE,
GFC_CAF_COARRAY_ALLOC);
+ gfc_add_modify (&block, dest, gfc_conv_descriptor_data_get (dummy_desc));
tmp = builtin_decl_explicit (BUILT_IN_MEMCPY);
tmp = build_call_expr_loc (input_location, tmp, 3, dest, src,
--- /dev/null
+!{ dg-do run }
+
+! Check that copying of memory for allocated scalar is assigned
+! to coarray object.
+
+! Contributed by G. Steinmetz <gscfq@t-online.de>
+
+program p
+ type t
+ integer, allocatable :: a
+ end type
+ type t2
+ type(t), allocatable :: b
+ end type
+ type(t2) :: x, y[*]
+
+ x%b = t(1)
+ y = x
+ y%b%a = 2
+
+ if (x%b%a /= 1) stop 1
+ if (y%b%a /= 2) stop 2
+end
+