From 88d27a09440fa3787b46f561aff05ad5a6af6b10 Mon Sep 17 00:00:00 2001 From: Marno van der Maas Date: Wed, 27 Nov 2024 16:42:46 +0000 Subject: [PATCH] ibex_pcounts: resolve uninitialize warning Although the current code isn't wrong as far as I can tell, it would be better to initialize the lognest_name_length variable when it is declared to avoid a build warning with older Verilator versions. --- dv/verilator/pcount/cpp/ibex_pcounts.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dv/verilator/pcount/cpp/ibex_pcounts.cc b/dv/verilator/pcount/cpp/ibex_pcounts.cc index 6924ee5261..b3f1bd380d 100644 --- a/dv/verilator/pcount/cpp/ibex_pcounts.cc +++ b/dv/verilator/pcount/cpp/ibex_pcounts.cc @@ -53,10 +53,9 @@ static bool has_hpm_counter(int index) { std::string ibex_pcount_string(bool csv) { char separator = csv ? ',' : ':'; - std::string::size_type longest_name_length; + std::string::size_type longest_name_length = 0; if (!csv) { - longest_name_length = 0; for (int i = 0; i < ibex_counter_names.size(); ++i) { if (has_hpm_counter(i)) { longest_name_length =