Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix uninitialized signal error #129

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ probe is required.
* openocd (version 0.11.0 or above)
* screen
* srecord
* verilator (version 5.024-1 or above)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been using 5.024, is there a difference between that and 5.024-1?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe no difference. However, I saw it being reference here as 5.024-1 unsure if this is an ubuntu thing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove the -1 because it is not reported by Verilator itself and it doesn't exist as a tag: https://github.com/verilator/verilator/tags


## Container Guide

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting that this wasn't flagged before. What behavior did this cause?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When trying to build the verilator simulation using:

fusesoc --cores-root=. run --target=sim --tool=verilator --setup --build lowrisc:ibex:demo_system

I got the following error:

ERROR: ../src/lowrisc_dv_verilator_ibex_pcounts_0/cpp/ibex_pcounts.cc: In function ‘std::string ibex_pcount_string(bool)’:
../src/lowrisc_dv_verilator_ibex_pcounts_0/cpp/ibex_pcounts.cc:80:41: warning: ‘longest_name_length’ may be used uninitialized [-Wmaybe-uninitialized]
   80 |       int padding = longest_name_length - ibex_counter_names[i].length();
      |                     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/lowrisc_dv_verilator_ibex_pcounts_0/cpp/ibex_pcounts.cc:56:26: note: ‘longest_name_length’ was declared here
   56 |   std::string::size_type longest_name_length;
      |                          ^~~~~~~~~~~~~~~~~~~

The full error message when building with the wrong verilator version (5.020) as well is in issue #125

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a change to vendored code, which essentially lives in another repository. The original file lives here: https://github.com/lowRISC/ibex/blob/master/dv/verilator/pcount/cpp/ibex_pcounts.cc
Would you like to make a PR in the Ibex repo or shall I do that for you?


if (!csv) {
longest_name_length = 0;
Expand Down