From a8e9fa09daf241b7ba63dc5c40f05e83efaf89be Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 13 Sep 2006 16:42:31 +0000 Subject: [PATCH] Fix some compiler warnings introduced in r11619. I checked with George: ompi_ddt_type_size() returns a signed int only because of the MPI spec; it will never return a negative value. So casting the return value out of it to a (uint32_t) is safe, and makes the comparisons be between two unsigned values. This commit was SVN r11639. The following SVN revision numbers were found above: r11619 --> open-mpi/ompi@8667648a1b602a2270c09f897e4dba6570545734 --- ompi/mca/coll/tuned/coll_tuned_bcast.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/ompi/mca/coll/tuned/coll_tuned_bcast.c b/ompi/mca/coll/tuned/coll_tuned_bcast.c index 667f7430ff..81c1211eac 100644 --- a/ompi/mca/coll/tuned/coll_tuned_bcast.c +++ b/ompi/mca/coll/tuned/coll_tuned_bcast.c @@ -85,8 +85,12 @@ ompi_coll_tuned_bcast_intra_chain ( void *buff, int count, segcount = count; num_segments = 1; } else { - /* segment the message */ - if (segsize < typelng) segsize = typelng; /* push segsize up to hold one type */ + /* segment the message (ompi_ddt_type_size() will never return + a negative value in typelng; it returns an int [vs. an + unsigned type] because of the MPI spec) */ + if (segsize < ((uint32_t) typelng)) { + segsize = typelng; /* push segsize up to hold one type */ + } segcount = segsize / typelng; if (segcount > count) { /* we have a single underfilled segment */ segcount = count; @@ -276,14 +280,17 @@ ompi_coll_tuned_bcast_intra_split_bintree ( void* buffer, err = ompi_ddt_type_size( datatype, &type_size ); - - /* Determine number of segments and number of elements per segment */ counts[0] = count/2; if (count % 2 != 0) counts[0]++; counts[1] = count - counts[0]; if ( segsize > 0 ) { - if (segsize < type_size) segsize = type_size; /* push segsize up to hold one type */ + /* Note that ompi_ddt_type_size() will never return a negative + value in typelng; it returns an int [vs. an unsigned type] + because of the MPI spec. */ + if (segsize < ((uint32_t) type_size)) { + segsize = type_size; /* push segsize up to hold one type */ + } segcount[0] = segcount[1] = segsize / type_size; num_segments[0] = counts[0]/segcount[0]; if ((counts[0] % segcount[0]) != 0) num_segments[0]++; @@ -531,7 +538,6 @@ ompi_coll_tuned_bcast_intra_bintree ( void* buffer, comm->c_coll_selected_data->cached_bintree_root = root; } - err = ompi_ddt_type_size( datatype, &type_size ); /* Determine number of segments and number of elements sent per operation */ @@ -540,8 +546,12 @@ ompi_coll_tuned_bcast_intra_bintree ( void* buffer, segcount = count; num_segments = 1; } else { - /* segment the message */ - if (segsize < type_size) segsize = type_size; /* push segsize up to hold one type */ + /* segment the message. Note that ompi_ddt_type_size() will + never return a negative value in typelng; it returns an int + [vs. an unsigned type] because of the MPI spec. */ + if (segsize < ((uint32_t) type_size)) { + segsize = type_size; /* push segsize up to hold one type */ + } segcount = segsize / type_size; if (segcount > count) { /* we have a single underfilled segment */ segcount = count;