{
tree fat_type, fieldlist, decl, arraytype;
char name[16 + 2*GFC_RANK_DIGITS + 1 + 1];
- int idx = 2 * (dimen - 1) + restricted;
+ int idx = 2 * (codimen + dimen - 1) + restricted;
gcc_assert (dimen >= 1 && codimen + dimen <= GFC_MAX_DIMENSIONS);
if (gfc_array_descriptor_base[idx])
/* Build the type node. */
fat_type = make_node (RECORD_TYPE);
- sprintf (name, "array_descriptor" GFC_RANK_PRINTF_FORMAT "_"
- GFC_RANK_PRINTF_FORMAT, dimen, codimen);
+ sprintf (name, "array_descriptor" GFC_RANK_PRINTF_FORMAT, dimen + codimen);
TYPE_NAME (fat_type) = get_identifier (name);
/* Add the data member as the first element of the descriptor. */
type_name = IDENTIFIER_POINTER (tmp);
else
type_name = "unknown";
- sprintf (name, "array" GFC_RANK_PRINTF_FORMAT "_"
- GFC_RANK_PRINTF_FORMAT "_%.*s", dimen, codimen,
+ sprintf (name, "array" GFC_RANK_PRINTF_FORMAT "_%.*s", dimen + codimen,
GFC_MAX_SYMBOL_LEN, type_name);
TYPE_NAME (fat_type) = get_identifier (name);
--- /dev/null
+! { dg-do run }
+! { dg-options "-fcoarray=single" }
+!
+! Coarray support -- allocatable array coarrays
+! PR fortran/18918
+! PR fortran/43931
+!
+program test
+ implicit none
+ call one()
+contains
+ subroutine one()
+ integer, allocatable :: a(:)[:,:,:]
+ allocate(a(1)[-4:9,8,4:*])
+ end subroutine one
+ subroutine four(C)
+ integer, allocatable :: C(:)[:]
+ end subroutine four
+end program test