Skip to content

Commit e2ad184

Browse files
ggouaillardetawlauria
authored andcommitted
pml/ob1: silence valgrind errors
always define and initialize padding in various structs when OPAL_ENABLE_DEBUG is set Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent 5751dfe commit e2ad184

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

ompi/mca/pml/ob1/pml_ob1_hdr.h

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Copyright (c) 2009 IBM Corporation. All rights reserved.
1414
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
1515
* reserved.
16+
* Copyright (c) 2018 Research Organization for Information Science
17+
* and Technology (RIST). All rights reserved.
1618
* $COPYRIGHT$
1719
*
1820
* Additional copyrights may follow
@@ -84,11 +86,11 @@ struct mca_pml_ob1_match_hdr_t {
8486
int32_t hdr_src; /**< source rank */
8587
int32_t hdr_tag; /**< user tag */
8688
uint16_t hdr_seq; /**< message sequence number */
87-
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
89+
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT || OPAL_ENABLE_DEBUG
8890
uint8_t hdr_padding[2]; /**< explicitly pad to 16 bytes. Compilers seem to already prefer to do this, but make it explicit just in case */
8991
#endif
9092
};
91-
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
93+
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT || OPAL_ENABLE_DEBUG
9294
#define OMPI_PML_OB1_MATCH_HDR_LEN 16
9395
#else
9496
#define OMPI_PML_OB1_MATCH_HDR_LEN 14
@@ -104,7 +106,7 @@ static inline void mca_pml_ob1_match_hdr_prepare (mca_pml_ob1_match_hdr_t *hdr,
104106
hdr->hdr_src = hdr_src;
105107
hdr->hdr_tag = hdr_tag;
106108
hdr->hdr_seq = hdr_seq;
107-
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG
109+
#if OPAL_ENABLE_DEBUG
108110
hdr->hdr_padding[0] = 0;
109111
hdr->hdr_padding[1] = 0;
110112
#endif
@@ -169,7 +171,7 @@ static inline void mca_pml_ob1_rendezvous_hdr_prepare (mca_pml_ob1_rendezvous_hd
169171
*/
170172
struct mca_pml_ob1_rget_hdr_t {
171173
mca_pml_ob1_rendezvous_hdr_t hdr_rndv;
172-
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
174+
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT || OPAL_ENABLE_DEBUG
173175
uint8_t hdr_padding[4];
174176
#endif
175177
opal_ptr_t hdr_frag; /**< source fragment (for fin) */
@@ -185,7 +187,7 @@ static inline void mca_pml_ob1_rget_hdr_prepare (mca_pml_ob1_rget_hdr_t *hdr, ui
185187
{
186188
mca_pml_ob1_rendezvous_hdr_prepare (&hdr->hdr_rndv, MCA_PML_OB1_HDR_TYPE_RGET, hdr_flags,
187189
hdr_ctx, hdr_src, hdr_tag, hdr_seq, hdr_msg_length, hdr_src_req);
188-
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG
190+
#if OPAL_ENABLE_DEBUG
189191
hdr->hdr_padding[0] = 0;
190192
hdr->hdr_padding[1] = 0;
191193
hdr->hdr_padding[2] = 0;
@@ -215,7 +217,7 @@ static inline void mca_pml_ob1_rget_hdr_prepare (mca_pml_ob1_rget_hdr_t *hdr, ui
215217
*/
216218
struct mca_pml_ob1_frag_hdr_t {
217219
mca_pml_ob1_common_hdr_t hdr_common; /**< common attributes */
218-
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
220+
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT || OPAL_ENABLE_DEBUG
219221
uint8_t hdr_padding[6];
220222
#endif
221223
uint64_t hdr_frag_offset; /**< offset into message */
@@ -229,7 +231,7 @@ static inline void mca_pml_ob1_frag_hdr_prepare (mca_pml_ob1_frag_hdr_t *hdr, ui
229231
uint64_t hdr_dst_req)
230232
{
231233
mca_pml_ob1_common_hdr_prepare (&hdr->hdr_common, MCA_PML_OB1_HDR_TYPE_FRAG, hdr_flags);
232-
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG
234+
#if OPAL_ENABLE_DEBUG
233235
hdr->hdr_padding[0] = 0;
234236
hdr->hdr_padding[1] = 0;
235237
hdr->hdr_padding[2] = 0;
@@ -260,7 +262,7 @@ static inline void mca_pml_ob1_frag_hdr_prepare (mca_pml_ob1_frag_hdr_t *hdr, ui
260262

261263
struct mca_pml_ob1_ack_hdr_t {
262264
mca_pml_ob1_common_hdr_t hdr_common; /**< common attributes */
263-
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
265+
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT || OPAL_ENABLE_DEBUG
264266
uint8_t hdr_padding[6];
265267
#endif
266268
opal_ptr_t hdr_src_req; /**< source request */
@@ -275,7 +277,7 @@ static inline void mca_pml_ob1_ack_hdr_prepare (mca_pml_ob1_ack_hdr_t *hdr, uint
275277
uint64_t hdr_send_offset, uint64_t hdr_send_size)
276278
{
277279
mca_pml_ob1_common_hdr_prepare (&hdr->hdr_common, MCA_PML_OB1_HDR_TYPE_ACK, hdr_flags);
278-
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG
280+
#if OPAL_ENABLE_DEBUG
279281
hdr->hdr_padding[0] = 0;
280282
hdr->hdr_padding[1] = 0;
281283
hdr->hdr_padding[2] = 0;
@@ -313,8 +315,8 @@ static inline void mca_pml_ob1_ack_hdr_prepare (mca_pml_ob1_ack_hdr_t *hdr, uint
313315

314316
struct mca_pml_ob1_rdma_hdr_t {
315317
mca_pml_ob1_common_hdr_t hdr_common; /**< common attributes */
316-
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
317-
uint8_t hdr_padding[2]; /** two to pad out the hdr to a 4 byte alignment. hdr_req will then be 8 byte aligned after 4 for hdr_seg_cnt */
318+
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT || OPAL_ENABLE_DEBUG
319+
uint8_t hdr_padding[6]; /** two to pad out the hdr to a 4 byte alignment. hdr_req will then be 8 byte aligned after 4 for hdr_seg_cnt */
318320
#endif
319321
/* TODO: add real support for multiple destination segments */
320322
opal_ptr_t hdr_req; /**< destination request */
@@ -334,9 +336,13 @@ static inline void mca_pml_ob1_rdma_hdr_prepare (mca_pml_ob1_rdma_hdr_t *hdr, ui
334336
size_t local_handle_size)
335337
{
336338
mca_pml_ob1_common_hdr_prepare (&hdr->hdr_common, MCA_PML_OB1_HDR_TYPE_PUT, hdr_flags);
337-
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG
339+
#if OPAL_ENABLE_DEBUG
338340
hdr->hdr_padding[0] = 0;
339341
hdr->hdr_padding[1] = 0;
342+
hdr->hdr_padding[2] = 0;
343+
hdr->hdr_padding[3] = 0;
344+
hdr->hdr_padding[4] = 0;
345+
hdr->hdr_padding[5] = 0;
340346
#endif
341347
hdr->hdr_req.lval = hdr_req;
342348
hdr->hdr_frag.pval = hdr_frag;
@@ -371,8 +377,8 @@ static inline void mca_pml_ob1_rdma_hdr_prepare (mca_pml_ob1_rdma_hdr_t *hdr, ui
371377

372378
struct mca_pml_ob1_fin_hdr_t {
373379
mca_pml_ob1_common_hdr_t hdr_common; /**< common attributes */
374-
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
375-
uint8_t hdr_padding[2];
380+
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT || OPAL_ENABLE_DEBUG
381+
uint8_t hdr_padding[6];
376382
#endif
377383
int64_t hdr_size; /**< number of bytes completed (positive), error code (negative) */
378384
opal_ptr_t hdr_frag; /**< completed RDMA fragment */
@@ -383,9 +389,13 @@ static inline void mca_pml_ob1_fin_hdr_prepare (mca_pml_ob1_fin_hdr_t *hdr, uint
383389
uint64_t hdr_frag, int64_t hdr_size)
384390
{
385391
mca_pml_ob1_common_hdr_prepare (&hdr->hdr_common, MCA_PML_OB1_HDR_TYPE_FIN, hdr_flags);
386-
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG
392+
#if OPAL_ENABLE_DEBUG
387393
hdr->hdr_padding[0] = 0;
388394
hdr->hdr_padding[1] = 0;
395+
hdr->hdr_padding[2] = 0;
396+
hdr->hdr_padding[3] = 0;
397+
hdr->hdr_padding[4] = 0;
398+
hdr->hdr_padding[5] = 0;
389399
#endif
390400
hdr->hdr_frag.lval = hdr_frag;
391401
hdr->hdr_size = hdr_size;

0 commit comments

Comments
 (0)