Skip to content

Commit

Permalink
ibex_pcounts: resolve uninitialize warning
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
marnovandermaas committed Nov 27, 2024
1 parent d2d55ed commit 7f71ba1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions dv/verilator/pcount/cpp/ibex_pcounts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 7f71ba1

Please sign in to comment.