From 11b375f8b569d6eb2ca2faa8ab8871106aef5473 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sat, 3 Jan 2009 15:56:25 +0000 Subject: [PATCH] CIDs 1080-1090: assert() checks were not sufficient to check for NEGATIVE_RETURNS from _reg_int() because those are not always checked. So replace them with real if() checks. This commit was SVN r20195. --- ompi/mca/coll/tuned/coll_tuned_allgather.c | 4 +++- ompi/mca/coll/tuned/coll_tuned_allgatherv.c | 4 +++- ompi/mca/coll/tuned/coll_tuned_allreduce.c | 4 +++- ompi/mca/coll/tuned/coll_tuned_alltoall.c | 8 ++++++-- ompi/mca/coll/tuned/coll_tuned_alltoallv.c | 4 +++- ompi/mca/coll/tuned/coll_tuned_barrier.c | 4 +++- ompi/mca/coll/tuned/coll_tuned_bcast.c | 4 +++- ompi/mca/coll/tuned/coll_tuned_gather.c | 4 +++- ompi/mca/coll/tuned/coll_tuned_reduce.c | 8 ++++++-- ompi/mca/coll/tuned/coll_tuned_reduce_scatter.c | 4 +++- ompi/mca/coll/tuned/coll_tuned_scatter.c | 4 +++- 11 files changed, 39 insertions(+), 13 deletions(-) diff --git a/ompi/mca/coll/tuned/coll_tuned_allgather.c b/ompi/mca/coll/tuned/coll_tuned_allgather.c index 7b966bd715..c74bac67df 100644 --- a/ompi/mca/coll/tuned/coll_tuned_allgather.c +++ b/ompi/mca/coll/tuned/coll_tuned_allgather.c @@ -765,7 +765,9 @@ ompi_coll_tuned_allgather_intra_check_forced_init(coll_tuned_force_algorithm_mca "allgather_algorithm", "Which allgather algorithm is used. Can be locked down to choice of: 0 ignore, 1 basic linear, 2 bruck, 3 recursive doubling, 4 ring, 5 neighbor exchange, 6: two proc only.", false, false, 0, NULL); - assert (mca_param_indices->algorithm_param_index >= 0); + if (mca_param_indices->algorithm_param_index < 0) { + return mca_param_indices->algorithm_param_index; + } mca_base_param_lookup_int(mca_param_indices->algorithm_param_index, &(requested_alg)); if( 0 > requested_alg || requested_alg > max_alg ) { diff --git a/ompi/mca/coll/tuned/coll_tuned_allgatherv.c b/ompi/mca/coll/tuned/coll_tuned_allgatherv.c index b3b69cac3a..d7977692f6 100644 --- a/ompi/mca/coll/tuned/coll_tuned_allgatherv.c +++ b/ompi/mca/coll/tuned/coll_tuned_allgatherv.c @@ -692,7 +692,9 @@ ompi_coll_tuned_allgatherv_intra_check_forced_init(coll_tuned_force_algorithm_mc "allgatherv_algorithm", "Which allgather algorithm is used. Can be locked down to choice of: 0 ignore, 1 default (gatherv + bcast), 2 bruck, 3 ring, 4 neighbor exchange, 5: two proc only.", false, false, 0, NULL); - assert (mca_param_indices->algorithm_param_index >= 0); + if (mca_param_indices->algorithm_param_index < 0) { + return mca_param_indices->algorithm_param_index; + } mca_base_param_lookup_int(mca_param_indices->algorithm_param_index, &(requested_alg)); if( 0 > requested_alg || requested_alg > max_alg ) { diff --git a/ompi/mca/coll/tuned/coll_tuned_allreduce.c b/ompi/mca/coll/tuned/coll_tuned_allreduce.c index e8fcc8a752..73113c4037 100644 --- a/ompi/mca/coll/tuned/coll_tuned_allreduce.c +++ b/ompi/mca/coll/tuned/coll_tuned_allreduce.c @@ -940,7 +940,9 @@ int ompi_coll_tuned_allreduce_intra_check_forced_init (coll_tuned_force_algorith "allreduce_algorithm", "Which allreduce algorithm is used. Can be locked down to any of: 0 ignore, 1 basic linear, 2 nonoverlapping (tuned reduce + tuned bcast), 3 recursive doubling, 4 ring, 5 segmented ring", false, false, 0, NULL); - assert (mca_param_indices->algorithm_param_index >= 0); + if (mca_param_indices->algorithm_param_index < 0) { + return mca_param_indices->algorithm_param_index; + } mca_base_param_lookup_int( mca_param_indices->algorithm_param_index, &(requested_alg)); if( 0 > requested_alg || requested_alg > max_alg ) { if( 0 == ompi_comm_rank( MPI_COMM_WORLD ) ) { diff --git a/ompi/mca/coll/tuned/coll_tuned_alltoall.c b/ompi/mca/coll/tuned/coll_tuned_alltoall.c index 86b8d2d964..d1391c7bfe 100644 --- a/ompi/mca/coll/tuned/coll_tuned_alltoall.c +++ b/ompi/mca/coll/tuned/coll_tuned_alltoall.c @@ -620,7 +620,9 @@ int ompi_coll_tuned_alltoall_intra_check_forced_init (coll_tuned_force_algorithm "alltoall_algorithm", "Which alltoall algorithm is used. Can be locked down to choice of: 0 ignore, 1 basic linear, 2 pairwise, 3: modified bruck, 4: linear with sync, 5:two proc only.", false, false, 0, NULL); - assert (mca_param_indices->algorithm_param_index >= 0); + if (mca_param_indices->algorithm_param_index < 0) { + return mca_param_indices->algorithm_param_index; + } mca_base_param_lookup_int(mca_param_indices->algorithm_param_index, &(requested_alg)); if( 0 > requested_alg || requested_alg > max_alg ) { if( 0 == ompi_comm_rank( MPI_COMM_WORLD ) ) { @@ -659,7 +661,9 @@ int ompi_coll_tuned_alltoall_intra_check_forced_init (coll_tuned_force_algorithm false, false, ompi_coll_tuned_init_max_requests, /* get system wide default */ NULL); - assert (mca_param_indices->max_requests_param_index >= 0); + if (mca_param_indices->max_requests_param_index < 0) { + return mca_param_indices->algorithm_param_index; + } mca_base_param_lookup_int(mca_param_indices->max_requests_param_index, &(max_requests)); if( max_requests <= 1 ) { if( 0 == ompi_comm_rank( MPI_COMM_WORLD ) ) { diff --git a/ompi/mca/coll/tuned/coll_tuned_alltoallv.c b/ompi/mca/coll/tuned/coll_tuned_alltoallv.c index 455c4bfb97..2fa06c049f 100644 --- a/ompi/mca/coll/tuned/coll_tuned_alltoallv.c +++ b/ompi/mca/coll/tuned/coll_tuned_alltoallv.c @@ -234,7 +234,9 @@ int ompi_coll_tuned_alltoallv_intra_check_forced_init(coll_tuned_force_algorithm "Can be locked down to choice of: 0 ignore, " "1 basic linear, 2 pairwise.", false, false, 0, NULL); - assert (mca_param_indices->algorithm_param_index >= 0); + if (mca_param_indices->algorithm_param_index < 0) { + return mca_param_indices->algorithm_param_index; + } mca_base_param_lookup_int(mca_param_indices->algorithm_param_index, &(requested_alg)); if (0 > requested_alg || requested_alg > max_alg) { if (0 == ompi_comm_rank( MPI_COMM_WORLD)) { diff --git a/ompi/mca/coll/tuned/coll_tuned_barrier.c b/ompi/mca/coll/tuned/coll_tuned_barrier.c index 220fb56afb..317adec8f3 100644 --- a/ompi/mca/coll/tuned/coll_tuned_barrier.c +++ b/ompi/mca/coll/tuned/coll_tuned_barrier.c @@ -428,7 +428,9 @@ int ompi_coll_tuned_barrier_intra_check_forced_init (coll_tuned_force_algorithm_ "barrier_algorithm", "Which barrier algorithm is used. Can be locked down to choice of: 0 ignore, 1 linear, 2 double ring, 3: recursive doubling 4: bruck, 5: two proc only, 6: tree", false, false, 0, NULL); - assert (mca_param_indices->algorithm_param_index >= 0); + if (mca_param_indices->algorithm_param_index < 0) { + return mca_param_indices->algorithm_param_index; + } mca_base_param_lookup_int(mca_param_indices->algorithm_param_index, &(requested_alg)); if( 0 > requested_alg || requested_alg > max_alg ) { diff --git a/ompi/mca/coll/tuned/coll_tuned_bcast.c b/ompi/mca/coll/tuned/coll_tuned_bcast.c index e7c67bd51b..d80d35e970 100644 --- a/ompi/mca/coll/tuned/coll_tuned_bcast.c +++ b/ompi/mca/coll/tuned/coll_tuned_bcast.c @@ -736,7 +736,9 @@ int ompi_coll_tuned_bcast_intra_check_forced_init (coll_tuned_force_algorithm_mc "bcast_algorithm", "Which bcast algorithm is used. Can be locked down to choice of: 0 ignore, 1 basic linear, 2 chain, 3: pipeline, 4: split binary tree, 5: binary tree, 6: binomial tree.", false, false, 0, NULL); - assert (mca_param_indices->algorithm_param_index >= 0); + if (mca_param_indices->algorithm_param_index < 0) { + return mca_param_indices->algorithm_param_index; + } mca_base_param_lookup_int(mca_param_indices->algorithm_param_index, &(requested_alg)); if( 0 > requested_alg || requested_alg > max_alg ) { if( 0 == ompi_comm_rank( MPI_COMM_WORLD ) ) { diff --git a/ompi/mca/coll/tuned/coll_tuned_gather.c b/ompi/mca/coll/tuned/coll_tuned_gather.c index 45b3981341..3b7cdf802c 100644 --- a/ompi/mca/coll/tuned/coll_tuned_gather.c +++ b/ompi/mca/coll/tuned/coll_tuned_gather.c @@ -450,7 +450,9 @@ ompi_coll_tuned_gather_intra_check_forced_init(coll_tuned_force_algorithm_mca_pa "gather_algorithm", "Which gather algorithm is used. Can be locked down to choice of: 0 ignore, 1 basic linear, 2 binomial, 3 linear with synchronization.", false, false, 0, NULL); - assert (mca_param_indices->algorithm_param_index >= 0); + if (mca_param_indices->algorithm_param_index < 0) { + return mca_param_indices->algorithm_param_index; + } mca_base_param_lookup_int(mca_param_indices->algorithm_param_index, &(requested_alg)); if( 0 > requested_alg || requested_alg > max_alg ) { diff --git a/ompi/mca/coll/tuned/coll_tuned_reduce.c b/ompi/mca/coll/tuned/coll_tuned_reduce.c index aa2297baa5..13438c91b4 100644 --- a/ompi/mca/coll/tuned/coll_tuned_reduce.c +++ b/ompi/mca/coll/tuned/coll_tuned_reduce.c @@ -729,7 +729,9 @@ int ompi_coll_tuned_reduce_intra_check_forced_init (coll_tuned_force_algorithm_m "reduce_algorithm", "Which reduce algorithm is used. Can be locked down to choice of: 0 ignore, 1 linear, 2 chain, 3 pipeline, 4 binary, 5 binomial, 6 in-order binary", false, false, 0, NULL); - assert (mca_param_indices->algorithm_param_index >= 0); + if (mca_param_indices->algorithm_param_index < 0) { + return mca_param_indices->algorithm_param_index; + } mca_base_param_lookup_int(mca_param_indices->algorithm_param_index, &(requested_alg)); if( 0 > requested_alg || requested_alg > max_alg ) { if( 0 == ompi_comm_rank( MPI_COMM_WORLD ) ) { @@ -768,7 +770,9 @@ int ompi_coll_tuned_reduce_intra_check_forced_init (coll_tuned_force_algorithm_m false, false, 0, /* no limit for reduce by default */ NULL); - assert (mca_param_indices->max_requests_param_index >= 0); + if (mca_param_indices->max_requests_param_index < 0) { + return mca_param_indices->max_requests_param_index; + } mca_base_param_lookup_int(mca_param_indices->max_requests_param_index, &(max_requests)); if( max_requests < 0 ) { if( 0 == ompi_comm_rank( MPI_COMM_WORLD ) ) { diff --git a/ompi/mca/coll/tuned/coll_tuned_reduce_scatter.c b/ompi/mca/coll/tuned/coll_tuned_reduce_scatter.c index 05f3de4601..6e2a366067 100644 --- a/ompi/mca/coll/tuned/coll_tuned_reduce_scatter.c +++ b/ompi/mca/coll/tuned/coll_tuned_reduce_scatter.c @@ -654,7 +654,9 @@ int ompi_coll_tuned_reduce_scatter_intra_check_forced_init (coll_tuned_force_alg "reduce_scatter_algorithm", "Which reduce reduce_scatter algorithm is used. Can be locked down to choice of: 0 ignore, 1 non-overlapping (Reduce + Scatterv), 2 recursive halving, 3 ring", false, false, 0, NULL); - assert (mca_param_indices->algorithm_param_index >= 0); + if (mca_param_indices->algorithm_param_index < 0) { + return mca_param_indices->algorithm_param_index; + } mca_base_param_lookup_int(mca_param_indices->algorithm_param_index, &(requested_alg)); if( 0 > requested_alg || requested_alg > max_alg ) { if( 0 == ompi_comm_rank( MPI_COMM_WORLD ) ) { diff --git a/ompi/mca/coll/tuned/coll_tuned_scatter.c b/ompi/mca/coll/tuned/coll_tuned_scatter.c index 8418897e67..3c5c19245b 100644 --- a/ompi/mca/coll/tuned/coll_tuned_scatter.c +++ b/ompi/mca/coll/tuned/coll_tuned_scatter.c @@ -290,7 +290,9 @@ ompi_coll_tuned_scatter_intra_check_forced_init(coll_tuned_force_algorithm_mca_p "scatter_algorithm", "Which scatter algorithm is used. Can be locked down to choice of: 0 ignore, 1 basic linear, 2 binomial.", false, false, 0, NULL); - assert (mca_param_indices->algorithm_param_index >= 0); + if (mca_param_indices->algorithm_param_index < 0) { + return mca_param_indices->algorithm_param_index; + } mca_base_param_lookup_int(mca_param_indices->algorithm_param_index, &(requested_alg)); if( 0 > requested_alg || requested_alg > max_alg ) {