diff --git a/src/ucs/datastruct/static_bitmap.h b/src/ucs/datastruct/static_bitmap.h index ef2884a3be8..c505193a383 100644 --- a/src/ucs/datastruct/static_bitmap.h +++ b/src/ucs/datastruct/static_bitmap.h @@ -229,7 +229,7 @@ BEGIN_C_DECLS #define _UCS_STATIC_BITMAP_UNARY_OP(_bitmap, _op_name, _uid) \ ({ \ ucs_typeof(_bitmap) _b_##_uid = (_bitmap); \ - ucs_typeof(_bitmap) _r_##_uid; \ + ucs_typeof(_bitmap) _r_##_uid = {0}; \ \ ucs_bitmap_bits_##_op_name(UCS_STATIC_BITMAP_BITS_ARGS(&_r_##_uid), \ UCS_STATIC_BITMAP_BITS_CARGS(&_b_##_uid)); \ @@ -255,7 +255,7 @@ BEGIN_C_DECLS ({ \ ucs_typeof(_bitmap1) _b1_##_uid = (_bitmap1); \ ucs_typeof(_bitmap2) _b2_##_uid = (_bitmap2); \ - ucs_typeof(_bitmap1) _r_##_uid; \ + ucs_typeof(_bitmap1) _r_##_uid = {0}; \ \ ucs_bitmap_bits_binary_op(UCS_STATIC_BITMAP_BITS_ARGS(&_r_##_uid), \ UCS_STATIC_BITMAP_BITS_CARGS(&_b1_##_uid), \ diff --git a/test/apps/iodemo/io_demo.cc b/test/apps/iodemo/io_demo.cc index cc696bc6b23..abd50ddbdf4 100644 --- a/test/apps/iodemo/io_demo.cc +++ b/test/apps/iodemo/io_demo.cc @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -2998,9 +2999,17 @@ static int do_client(options_t& test_opts) IoDemoRandom::srand(test_opts.random_seed); LOG << "random seed: " << test_opts.random_seed; - // randomize servers to optimize startup + // randomize servers to optimize startup (handle C++17+) +#if __cplusplus >= 201703L + // std::shuffle replaces std::random_shuffle in C++17 + std::random_device rd; + std::mt19937 rng(rd()); + std::shuffle(test_opts.servers.begin(), test_opts.servers.end(), rng); +#else + // For older C++ standards, keep std::random_shuffle std::random_shuffle(test_opts.servers.begin(), test_opts.servers.end(), IoDemoRandom::urand); +#endif UcxLog vlog(LOG_PREFIX, test_opts.verbose); vlog << "List of servers:";