- if ((old_type->flags & DT_FLAG_COMMITED) != DT_FLAG_COMMITED) {
- retval = MPI_ERR_TYPE;
- } else {
- if(stride != blocklen){
-if (old_type->has_subtype == 1)
- XBT_WARN("vector contains a complex type - not yet handled");
- s_smpi_mpi_vector_t* subtype = smpi_datatype_vector_create( stride,
- blocklen,
- count,
- old_type,
- smpi_datatype_size(old_type));
-
- smpi_datatype_create(new_type, count * (blocklen) *
- smpi_datatype_size(old_type),
- ((count -1) * stride + blocklen) * smpi_datatype_size(old_type),
- 1,
- subtype,
- DT_FLAG_VECTOR);
- retval=MPI_SUCCESS;
- }else{
- /* in this situation the data are contignous thus it's not
- * required to serialize and unserialize it*/
- smpi_datatype_create(new_type, count * blocklen *
- smpi_datatype_size(old_type), ((count -1) * stride + blocklen)*
- smpi_datatype_size(old_type),
- 0,
- NULL,
- DT_FLAG_VECTOR|DT_FLAG_CONTIGUOUS);
- retval=MPI_SUCCESS;
- }
+ MPI_Aint lb = 0;
+ MPI_Aint ub = 0;
+ if(count>0){
+ lb=smpi_datatype_lb(old_type);
+ ub=((count-1)*stride+blocklen-1)*smpi_datatype_get_extent(old_type)+smpi_datatype_ub(old_type);
+ }
+ if(old_type->has_subtype || stride != blocklen){
+
+
+ s_smpi_mpi_vector_t* subtype = smpi_datatype_vector_create( stride,
+ blocklen,
+ count,
+ old_type,
+ smpi_datatype_size(old_type));
+ smpi_datatype_create(new_type,
+ count * (blocklen) * smpi_datatype_size(old_type), lb,
+ ub,
+ 1,
+ subtype,
+ DT_FLAG_VECTOR);
+ retval=MPI_SUCCESS;
+ }else{
+ /* in this situation the data are contignous thus it's not
+ * required to serialize and unserialize it*/
+ smpi_datatype_create(new_type, count * blocklen *
+ smpi_datatype_size(old_type), 0, ((count -1) * stride + blocklen)*
+ smpi_datatype_size(old_type),
+ 0,
+ NULL,
+ DT_FLAG_VECTOR|DT_FLAG_CONTIGUOUS);
+ retval=MPI_SUCCESS;