6
6
* reserved.
7
7
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
8
8
* Copyright (c) 2012-2013 Inria. All rights reserved.
9
- * Copyright (c) 2014-2017 Research Organization for Information Science
9
+ * Copyright (c) 2014-2018 Research Organization for Information Science
10
10
* and Technology (RIST). All rights reserved.
11
11
* Copyright (c) 2014 Intel, Inc. All rights reserved.
12
12
*
13
- * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
13
+ * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
14
14
* $COPYRIGHT$
15
15
*
16
16
* Additional copyrights may follow
@@ -107,7 +107,7 @@ static inline int memchecker_call (int (*f)(void *, size_t), const void * addr,
107
107
108
108
if ( datatype -> super .size == (size_t ) (datatype -> super .true_ub - datatype -> super .true_lb ) ) {
109
109
/* We have a contiguous type. */
110
- f ( (void * )addr , datatype -> super .size * count );
110
+ f ( (void * )(( char * ) addr + datatype -> super . true_lb ) , datatype -> super .size * count );
111
111
} else {
112
112
/* Now we got a noncontigous type. */
113
113
uint32_t elem_pos = 0 , i ;
@@ -128,7 +128,18 @@ static inline int memchecker_call (int (*f)(void *, size_t), const void * addr,
128
128
129
129
while ( pElem -> elem .common .flags & OPAL_DATATYPE_FLAG_DATA ) {
130
130
/* now here we have a basic datatype */
131
- f ( (void * )(source_base + pElem -> elem .disp ), pElem -> elem .count * pElem -> elem .extent );
131
+ size_t blength = opal_datatype_basicDatatypes [pElem -> elem .common .type ]-> size ;
132
+ if ((size_t )pElem -> elem .extent == blength ) {
133
+ /* block is made of contiguous basic datatype */
134
+ f ( (void * )(source_base + pElem -> elem .disp ), pElem -> elem .count * pElem -> elem .extent );
135
+ } else {
136
+ uint32_t j ;
137
+ ptrdiff_t offset ;
138
+ for (j = 0 , offset = 0 ; j < pElem -> elem .count ; j ++ ) {
139
+ f ( (void * )(source_base + pElem -> elem .disp + offset ), blength );
140
+ offset += pElem -> elem .extent ;
141
+ }
142
+ }
132
143
elem_pos ++ ; /* advance to the next data */
133
144
pElem = & (description [elem_pos ]);
134
145
continue ;
0 commit comments