+2013-04-12 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/56929
+ * trans-array.c (duplicate_allocatable): Fix handling
+ of scalar coarrays.
+
2013-04-12 Janus Weil <janus@gcc.gnu.org>
PR fortran/56261
allocate memory to the destination. */
gfc_init_block (&block);
- if (rank == 0)
+ if (!GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (dest)))
{
tmp = null_pointer_node;
tmp = fold_build2_loc (input_location, MODIFY_EXPR, type, dest, tmp);
null_data = gfc_finish_block (&block);
gfc_init_block (&block);
- nelems = get_full_array_size (&block, src, rank);
+ if (rank)
+ nelems = get_full_array_size (&block, src, rank);
+ else
+ nelems = gfc_index_one_node;
+
tmp = fold_convert (gfc_array_index_type,
TYPE_SIZE_UNIT (gfc_get_element_type (type)));
size = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type,
/* Null the destination if the source is null; otherwise do
the allocate and copy. */
- if (rank == 0)
+ if (!GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (src)))
null_cond = src;
else
null_cond = gfc_conv_descriptor_data_get (src);
--- /dev/null
+! { dg-do compile }
+!
+! PR fortran/56929
+!
+! Contributed by Damian Rouson
+!
+! Allocatable scalar corrays were mishandled (ICE)
+!
+module parent_coarray_component
+ type parent
+ real, allocatable :: dummy[:]
+ end type
+ type, extends(parent) :: child
+ end type
+contains
+ subroutine do_something(this)
+ class(child) this
+ end
+end