Skip to content

Commit dbae9c0

Browse files
committed
romio/romio321: silence some compiler warnings
Some compilers complain when comparing signed and unsigned. romio321 was doing just this. The check is meant to check whether a size (which is an ADIO_Offset-- a signed number) will work with memcpy which takes a size_t. To silence the warning I added a new type (ADIO_Size) which is an unsigned type and cast the ADIO_Offset to this new type. Fixes #5951 Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
1 parent 6213d23 commit dbae9c0

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

ompi/mca/io/romio321/romio/adio/common/ad_read_coll.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype
735735
if (for_next_iter) {
736736
tmp_buf = (char *) ADIOI_Malloc(for_next_iter);
737737
ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)read_buf)+real_size-for_next_iter) == (ADIO_Offset)(MPIU_Upint)(read_buf+real_size-for_next_iter));
738-
ADIOI_Assert((for_next_iter+coll_bufsize) == (size_t)(for_next_iter+coll_bufsize));
738+
ADIOI_Assert((ADIO_Size) (for_next_iter+coll_bufsize) == (size_t)(for_next_iter+coll_bufsize));
739739
memcpy(tmp_buf, read_buf+real_size-for_next_iter, for_next_iter);
740740
ADIOI_Free(fd->io_buf);
741741
fd->io_buf = (char *) ADIOI_Malloc(for_next_iter+coll_bufsize);
@@ -929,7 +929,7 @@ static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node
929929
while (size) { \
930930
size_in_buf = ADIOI_MIN(size, flat_buf_sz); \
931931
ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + user_buf_idx) == (ADIO_Offset)(MPIU_Upint)((MPIU_Upint)buf + user_buf_idx)); \
932-
ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \
932+
ADIOI_Assert((ADIO_Size) size_in_buf == (size_t)size_in_buf); \
933933
memcpy(((char *) buf) + user_buf_idx, \
934934
&(recv_buf[p][recv_buf_idx[p]]), size_in_buf); \
935935
recv_buf_idx[p] += size_in_buf; /* already tested (size_t)size_in_buf*/ \

ompi/mca/io/romio321/romio/adio/common/ad_read_str.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
&status1, error_code); \
3535
if (*error_code != MPI_SUCCESS) return; \
3636
} \
37-
ADIOI_Assert(req_len == (size_t)req_len); \
37+
ADIOI_Assert((ADIO_Size) req_len == (size_t)req_len); \
3838
memcpy((char *)buf + userbuf_off, readbuf+req_off-readbuf_off, req_len); \
3939
}
4040

ompi/mca/io/romio321/romio/adio/common/ad_write_coll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf,
832832
while (size) { \
833833
size_in_buf = ADIOI_MIN(size, flat_buf_sz); \
834834
ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + user_buf_idx) == (ADIO_Offset)(MPIU_Upint)((MPIU_Upint)buf + user_buf_idx)); \
835-
ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \
835+
ADIOI_Assert((ADIO_Size) size_in_buf == (size_t)size_in_buf); \
836836
memcpy(&(send_buf[p][send_buf_idx[p]]), \
837837
((char *) buf) + user_buf_idx, size_in_buf); \
838838
send_buf_idx[p] += size_in_buf; \

ompi/mca/io/romio321/romio/adio/common/ad_write_nolock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ void ADIOI_NOLOCK_WriteStrided(ADIO_File fd, const void *buf, int count,
335335
#ifdef ADIOI_MPE_LOGGING
336336
MPE_Log_event( ADIOI_MPE_write_a, 0, NULL );
337337
#endif
338-
ADIOI_Assert(size == (size_t) size);
338+
ADIOI_Assert((ADIO_Size) size == (size_t) size);
339339
ADIOI_Assert(off == (off_t) off);
340340
err = write(fd->fd_sys, ((char *) buf) + indx, size);
341341
#ifdef ADIOI_MPE_LOGGING

ompi/mca/io/romio321/romio/adio/include/adio.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,23 @@
9696

9797
#ifdef MPI_OFFSET_IS_INT
9898
typedef int ADIO_Offset;
99+
typedef unsigned ADIO_Size;
99100
# define ADIO_OFFSET MPI_INT
100101
#elif defined(HAVE_LONG_LONG_64)
101102
typedef long long ADIO_Offset;
103+
typedef unsigned long long ADIO_Size;
102104
# ifdef HAVE_MPI_LONG_LONG_INT
103105
# define ADIO_OFFSET MPI_LONG_LONG_INT
104106
# else
105107
# define ADIO_OFFSET MPI_DOUBLE
106108
# endif
107109
#elif defined(HAVE_INT64)
108110
typedef __int64 ADIO_Offset;
111+
typedef unsigned __int64 ADIO_Size;
109112
# define ADIO_OFFSET MPI_DOUBLE
110113
#else
111114
typedef long ADIO_Offset;
115+
typedef unsigned long ADIO_Size;
112116
# define ADIO_OFFSET MPI_LONG
113117
#endif
114118

0 commit comments

Comments
 (0)