From 7f8c08a87676b385ddd9546136af92b28cde5256 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Fri, 28 Jun 2024 14:33:02 +0200 Subject: [PATCH 1/3] Fix maybe-uninitialized warnings --- src_c/IMB_exchange.c | 2 +- src_c/IMB_output.c | 2 +- src_cpp/helpers/helper_IMB_functions.h | 2 +- src_cpp/helpers/original_benchmark.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src_c/IMB_exchange.c b/src_c/IMB_exchange.c index ca2ead47..85d10251 100644 --- a/src_c/IMB_exchange.c +++ b/src_c/IMB_exchange.c @@ -107,7 +107,7 @@ Output variables: int s_num = 0, r_num = 0; int s_tag, r_tag; - int left, right; + int left = 0, right = 0; MPI_Status stat[2]; MPI_Request request[2]; diff --git a/src_c/IMB_output.c b/src_c/IMB_output.c index bad342b1..260277ed 100644 --- a/src_c/IMB_output.c +++ b/src_c/IMB_output.c @@ -139,7 +139,7 @@ Input variables: 3 numbers (min/max/average) */ - double scaled_time[MAX_TIME_ID]; + double scaled_time[MAX_TIME_ID] = {0}; int i, i_gr; int out_format; diff --git a/src_cpp/helpers/helper_IMB_functions.h b/src_cpp/helpers/helper_IMB_functions.h index 85024238..0d05d81b 100755 --- a/src_cpp/helpers/helper_IMB_functions.h +++ b/src_cpp/helpers/helper_IMB_functions.h @@ -378,7 +378,7 @@ struct Bmark_descr { { /* IMB 3.1 << */ - size_t s_len, r_len, s_alloc, r_alloc; + size_t s_len = 0, r_len = 0, s_alloc, r_alloc; int init_size, irep, i_s, i_r, x_sample; int asize = (int) sizeof(assign_type); diff --git a/src_cpp/helpers/original_benchmark.h b/src_cpp/helpers/original_benchmark.h index 59c373fc..5ed2fda6 100644 --- a/src_cpp/helpers/original_benchmark.h +++ b/src_cpp/helpers/original_benchmark.h @@ -134,7 +134,7 @@ class OriginalBenchmark : public Benchmark { int np = item.np; int imod = *(item.extra_fields.as()); double t; - MPI_Datatype base_s_dt, base_r_dt, base_red_dt; + MPI_Datatype base_s_dt = 0, base_r_dt = 0, base_red_dt = 0; if (!initialized) return; if (descr->stop_iterations) From 80a57472ef0d008aa4013066895656bd944d8336 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Fri, 28 Jun 2024 14:33:27 +0200 Subject: [PATCH 2/3] Don't use deprecated std::binary_function --- src_cpp/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src_cpp/utils.h b/src_cpp/utils.h index 9e9a1eb5..e72c73f6 100644 --- a/src_cpp/utils.h +++ b/src_cpp/utils.h @@ -72,7 +72,7 @@ namespace set_operations { transform(list.begin(), list.end(), inserter(tmp, tmp.end()), to_lower); list = tmp; } - struct case_insens_cmp : public std::binary_function { + struct case_insens_cmp { bool operator()(const std::string &lhs, const std::string &rhs) const { #ifdef WIN_IMB return stricmp(lhs.c_str(), rhs.c_str()) < 0; From 4a65588c41a456313b9b29df3e7eae1158468279 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Fri, 28 Jun 2024 15:34:19 +0200 Subject: [PATCH 3/3] Ignore false positive free-nonheap-object warning --- src_cpp/MPI1/MPI1_suite.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src_cpp/MPI1/MPI1_suite.cpp b/src_cpp/MPI1/MPI1_suite.cpp index c9788156..88b21fde 100644 --- a/src_cpp/MPI1/MPI1_suite.cpp +++ b/src_cpp/MPI1/MPI1_suite.cpp @@ -840,6 +840,10 @@ template <> void BenchmarkSuite::get_bench_list(vector &benchs, result.detach_ptr(); } +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wfree-nonheap-object" +#endif template<> any BenchmarkSuite::get_parameter(const std::string &key) { using namespace NS_MPI1; any result; @@ -848,6 +852,9 @@ template<> any BenchmarkSuite::get_parameter(const std::string &key) { HANDLE_PARAMETER(GLOBALS, glob); return result; } +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif #ifdef WIN32 template BenchmarkSuite;