Skip to content

Commit b30cd90

Browse files
author
Damian Rouson
committed
Corrected co_broadcast argument size check (previous version was inadvertently hardwired to work only for the tested string length).
1 parent bc54446 commit b30cd90

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/libcaf-gfortran-descriptor.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,9 @@ typedef struct gfc_descriptor_t {
133133
receives in the dtype component its gf_descriptor_t argument for character(kind=c_char)
134134
and logical(kind=c_bool) data:
135135
*/
136-
#define GFC_DTYPE_CHARACTER 944
136+
#define GFC_DTYPE_CHARACTER 48
137137

138138
#if 0
139-
#define GFC_DTYPE_LOGICAL_4 8
140139
#define GFC_DTYPE_CHARACTER ((BT_CHARACTER << GFC_DTYPE_TYPE_SHIFT) \
141140
| (sizeof(char) << GFC_DTYPE_SIZE_SHIFT))
142141
#endif

src/mpi/mpi_caf.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -1839,9 +1839,13 @@ get_MPI_datatype (gfc_descriptor_t *desc)
18391839
return MPI_COMPLEX;
18401840
case GFC_DTYPE_COMPLEX_8:
18411841
return MPI_DOUBLE_COMPLEX;
1842-
case GFC_DTYPE_CHARACTER:
1843-
return MPI_CHARACTER;
18441842
}
1843+
/* gfortran passes character string arguments with a
1844+
GFC_DTYPE_TYPE_SIZE == GFC_TYPE_CHARACTER + 64*strlen
1845+
*/
1846+
if ( (GFC_DTYPE_TYPE_SIZE(desc)-GFC_DTYPE_CHARACTER)%64==0 )
1847+
return MPI_CHARACTER;
1848+
18451849
caf_runtime_error ("Unsupported data type in collective: %ld\n",GFC_DTYPE_TYPE_SIZE (desc));
18461850
return 0;
18471851
}

0 commit comments

Comments
 (0)