Commit 6f267e79 authored by Jeff Hammond's avatar Jeff Hammond Committed by Pavan Balaji
Browse files

remove cast-to-integer associated with count field



goal: make MPICH count-safe
problem: casting to int when value exceeds INT_MAX
solution: remove all "(int)" in front of values assigned to the count
field
Signed-off-by: Rob Latham's avatarRob Latham <robl@mcs.anl.gov>
parent bf57cc47
......@@ -607,7 +607,7 @@ MPID_nem_mx_handle_rreq(MPID_Request *req, mx_status_t status)
MPID_Segment_unpack( req->dev.segment_ptr, 0, &last, req->dev.tmpbuf );
MPIU_Free(req->dev.tmpbuf);
if (last != data_sz) {
MPIR_STATUS_SET_COUNT(req->status, (int)last);
MPIR_STATUS_SET_COUNT(req->status, last);
if (req->dev.recv_data_sz <= userbuf_sz) {
MPIU_ERR_SETSIMPLE(req->status.MPI_ERROR,MPI_ERR_TYPE,"**dtypemismatch");
}
......
......@@ -373,7 +373,7 @@ MPID_nem_newmad_handle_rreq(MPID_Request *req, nm_tag_t match_info, size_t size)
MPID_Segment_unpack( req->dev.segment_ptr, 0, &last, req->dev.tmpbuf);
MPIU_Free(req->dev.tmpbuf);
if (last != data_sz) {
MPIR_STATUS_SET_COUNT(req->status, (int)last);
MPIR_STATUS_SET_COUNT(req->status, last);
if (req->dev.recv_data_sz <= userbuf_sz) {
MPIU_ERR_SETSIMPLE(req->status.MPI_ERROR,MPI_ERR_TYPE,"**dtypemismatch");
}
......
......@@ -239,7 +239,7 @@ int MPIDI_CH3_RecvFromSelf( MPID_Request *rreq, void *buf, int count,
sreq->dev.datatype, &sreq->status.MPI_ERROR,
buf, count, datatype, &data_sz,
&rreq->status.MPI_ERROR);
MPIR_STATUS_SET_COUNT(rreq->status, (int)data_sz);
MPIR_STATUS_SET_COUNT(rreq->status, data_sz);
MPID_REQUEST_SET_COMPLETED(sreq);
MPID_Request_release(sreq);
}
......
......@@ -405,7 +405,7 @@ int MPIDI_CH3_PktHandler_EagerShortSend( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
/* There are two cases: a datatype mismatch (could
not consume all data) or a too-short buffer. We
need to distinguish between these two types. */
MPIR_STATUS_SET_COUNT(rreq->status, (int)last);
MPIR_STATUS_SET_COUNT(rreq->status, last);
if (rreq->dev.recv_data_sz <= userbuf_sz) {
MPIU_ERR_SETSIMPLE(rreq->status.MPI_ERROR,MPI_ERR_TYPE,
"**dtypemismatch");
......
......@@ -198,7 +198,7 @@ int MPIDI_CH3U_Receive_data_found(MPID_Request *rreq, char *buf, MPIDI_msg_sz_t
mismatch between the datatype and the amount of
data received. Throw away received data. */
MPIU_ERR_SET(rreq->status.MPI_ERROR, MPI_ERR_TYPE, "**dtypemismatch");
MPIR_STATUS_SET_COUNT(rreq->status, (int)rreq->dev.segment_first);
MPIR_STATUS_SET_COUNT(rreq->status, rreq->dev.segment_first);
*buflen = data_sz;
*complete = TRUE;
/* FIXME: Set OnDataAvail to 0? If not, why not? */
......
......@@ -381,7 +381,7 @@ int MPIDI_CH3U_Request_load_recv_iov(MPID_Request * const rreq)
rreq->status.MPI_ERROR = MPIR_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_TYPE,
"**dtypemismatch", 0);
MPIR_STATUS_SET_COUNT(rreq->status, (int)rreq->dev.segment_first);
MPIR_STATUS_SET_COUNT(rreq->status, rreq->dev.segment_first);
rreq->dev.segment_size = rreq->dev.segment_first;
mpi_errno = MPIDI_CH3U_Request_load_recv_iov(rreq);
goto fn_exit;
......@@ -518,7 +518,7 @@ int MPIDI_CH3U_Request_unpack_srbuf(MPID_Request * rreq)
/* If no data can be unpacked, then we have a datatype processing
problem. Adjust the segment info so that the remaining
data is received and thrown away. */
MPIR_STATUS_SET_COUNT(rreq->status, (int)rreq->dev.segment_first);
MPIR_STATUS_SET_COUNT(rreq->status, rreq->dev.segment_first);
rreq->dev.segment_size = rreq->dev.segment_first;
rreq->dev.segment_first += tmpbuf_last;
rreq->status.MPI_ERROR = MPIR_Err_create_code(MPI_SUCCESS,
......@@ -536,7 +536,7 @@ int MPIDI_CH3U_Request_unpack_srbuf(MPID_Request * rreq)
Note: the segment_first field is set to segment_last so that if
this is a truncated message, extra data will be read
off the pipe. */
MPIR_STATUS_SET_COUNT(rreq->status, (int)last);
MPIR_STATUS_SET_COUNT(rreq->status, last);
rreq->dev.segment_size = last;
rreq->dev.segment_first = tmpbuf_last;
rreq->status.MPI_ERROR = MPIR_Err_create_code(MPI_SUCCESS,
......@@ -600,7 +600,7 @@ int MPIDI_CH3U_Request_unpack_uebuf(MPID_Request * rreq)
", buf_sz=" MPIDI_MSG_SZ_FMT,
rreq->dev.recv_data_sz, userbuf_sz));
unpack_sz = userbuf_sz;
MPIR_STATUS_SET_COUNT(rreq->status, (int)userbuf_sz);
MPIR_STATUS_SET_COUNT(rreq->status, userbuf_sz);
rreq->status.MPI_ERROR = MPIR_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_TRUNCATE,
"**truncate", "**truncate %d %d",
......@@ -636,7 +636,7 @@ int MPIDI_CH3U_Request_unpack_uebuf(MPID_Request * rreq)
/* received data was not entirely consumed by unpack()
because too few bytes remained to fill the next basic
datatype */
MPIR_STATUS_SET_COUNT(rreq->status, (int)last);
MPIR_STATUS_SET_COUNT(rreq->status, last);
rreq->status.MPI_ERROR = MPIR_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_TYPE,
"**dtypemismatch", 0);
......
......@@ -74,7 +74,7 @@ int MPIDI_Isend_self(const void * buf, int count, MPI_Datatype datatype, int ran
MPIDI_CH3U_Buffer_copy(buf, count, datatype, &sreq->status.MPI_ERROR,
rreq->dev.user_buf, rreq->dev.user_count, rreq->dev.datatype, &data_sz, &rreq->status.MPI_ERROR);
MPIR_STATUS_SET_COUNT(rreq->status, (int)data_sz);
MPIR_STATUS_SET_COUNT(rreq->status, data_sz);
MPID_REQUEST_SET_COMPLETED(rreq);
MPID_Request_release(rreq);
/* sreq has never been seen by the user or outside this thread, so it is safe to reset ref_count and cc */
......
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