Commit d8b8eb6f authored by Antonio J. Pena's avatar Antonio J. Pena
Browse files

Fix warnings about possible uninitialized accesses

Fixes compiler warnings related to the possible use of uninitialized memory in
mpiu_chkpmem_stk_[0] and mpir_sched_chkpmem_stk_[0]. A couple of examples:

src/mpid/ch3/src/ch3u_rma_sync.c: In function 'MPIDI_CH3I_Recv_rma_msg':
src/mpid/ch3/src/ch3u_rma_sync.c:1265:5: warning: 'mpiu_chkpmem_stk_[0]'
may be used uninitialized in this function [-Wmaybe-uninitialized]

src/mpi/coll/iallgather.c: In function 'MPIR_Iallgather_bruck':
src/mpi/coll/iallgather.c:329:5: warning: 'mpir_sched_chkpmem_stk_[0]' may
be used uninitialized in this function [-Wmaybe-uninitialized]

While the code seems correct, this patch avoids the warning.

See ticket #1966
Signed-off-by: default avatarWesley Bland <>
parent 6e8dae1b
......@@ -368,7 +368,7 @@ if (pointer_) { \
/* Persistent memory that we may want to recover if something goes wrong */
#define MPIU_CHKPMEM_DECL(n_) \
void *(mpiu_chkpmem_stk_[n_]);\
void *(mpiu_chkpmem_stk_[n_]) = { NULL }; \
int mpiu_chkpmem_stk_sp_=0;\
MPIU_AssertDeclValue(const int mpiu_chkpmem_stk_sz_,n_)
#define MPIU_CHKPMEM_MALLOC_ORSTMT(pointer_,type_,nbytes_,rc_,name_,stmt_) \
......@@ -117,7 +117,7 @@ int MPIR_Sched_cb_free_buf(MPID_Comm *comm, int tag, void *state);
/* an upgraded version of MPIU_CHKPMEM_MALLOC/_DECL/_REAP/_COMMIT that adds
* corresponding cleanup callbacks to the given schedule at _COMMIT time */
void *(mpir_sched_chkpmem_stk_[n_]); \
void *(mpir_sched_chkpmem_stk_[n_]) = { NULL }; \
int mpir_sched_chkpmem_stk_sp_=0; \
MPIU_AssertDeclValue(const int mpir_sched_chkpmem_stk_sz_,n_)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment