@@ -2026,30 +2026,25 @@ copy_char_to_self(void *src, int src_type, int src_size, int src_kind,
20262026
20272027static void
20282028copy_to_self (gfc_descriptor_t * src , int src_kind ,
2029- gfc_descriptor_t * dst , int dst_kind , size_t elem_size , int * stat )
2029+ gfc_descriptor_t * dest , int dst_kind , size_t size , int * stat )
20302030{
2031- const int src_size = GFC_DESCRIPTOR_SIZE (src ),
2032- dst_size = GFC_DESCRIPTOR_SIZE (dst );
2033- const int src_type = GFC_DESCRIPTOR_TYPE (src ),
2034- dst_type = GFC_DESCRIPTOR_TYPE (dst );
2035- const int src_rank = GFC_DESCRIPTOR_RANK (src ),
2036- dst_rank = GFC_DESCRIPTOR_RANK (dst );
20372031#ifdef GFC_CAF_CHECK
2038- if (dst_type == BT_CHARACTER || src_type == BT_CHARACTER )
2032+ if (GFC_DESCRIPTOR_TYPE (dest ) == BT_CHARACTER
2033+ || GFC_DESCRIPTOR_TYPE (src ) == BT_CHARACTER )
20392034 caf_runtime_error ("internal error: copy_to_self() for char types called." );
20402035#endif
20412036 /* The address of dest passed by the compiler points on the right
2042- * memory location. No offset summation is needed. Use the convert with
2043- * strides when src is a scalar. */
2044- if (dst_kind == src_kind && dst_size == src_size && dst_type == src_type
2045- && src_rank == dst_rank )
2046- memmove (dst -> base_addr , src -> base_addr , elem_size * dst_size );
2037+ * memory location. No offset summation is needed. */
2038+ if (dst_kind == src_kind )
2039+ memmove (dest -> base_addr , src -> base_addr , size * GFC_DESCRIPTOR_SIZE (dest ));
20472040 else
20482041 /* When the rank is 0 then a scalar is copied to a vector and the stride
20492042 * is zero. */
2050- convert_with_strides (dst -> base_addr , dst_type , dst_kind ,
2051- dst_size , src -> base_addr , src_type , src_kind ,
2052- src_rank > 0 ? src_size : 0 , elem_size , stat );
2043+ convert_with_strides (dest -> base_addr , GFC_DESCRIPTOR_TYPE (dest ), dst_kind ,
2044+ GFC_DESCRIPTOR_SIZE (dest ), src -> base_addr ,
2045+ GFC_DESCRIPTOR_TYPE (src ), src_kind ,
2046+ (GFC_DESCRIPTOR_RANK (src ) > 0 )
2047+ ? GFC_DESCRIPTOR_SIZE (src ) : 0 , size , stat );
20532048}
20542049
20552050/* token: The token of the array to be written to.
0 commit comments