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

-Wsign-compare warning in verilated.cpp #1437

Closed
veripoolbot opened this issue May 14, 2019 · 2 comments
Closed

-Wsign-compare warning in verilated.cpp #1437

veripoolbot opened this issue May 14, 2019 · 2 comments
Labels
area: configure/compiling Issue involves configuring or compilating Verilator itself resolution: fixed Closed; fixed

Comments

@veripoolbot
Copy link
Contributor


Author Name: Sergey Kvachonok (@ravenexp)
Original Redmine Issue: 1437 from https://www.veripool.org

Original Assignee: Sergey Kvachonok (@ravenexp)


I do not use verilated.mk to compile the generated C++ code, and I get these warnings (CFLAGS = -Wall -Wextra)

 /usr/share/verilator/include/verilated.cpp:1319:41: warning: comparison of integer expressions of different signedness: ‘int’ and ‘IData’ {aka ‘unsigned int’} [-Wsign-compare]
     for (int row_addr = start; row_addr <= end; ++row_addr) {
                                 ~~~~~~~~~^~~~~~

I've modified VL_WRITEMEM_N() to use unsigned size and offset integer types throughout and moved the address range checks out of the writing loop.
I believe it is better to fail these checks as early as possible and avoid creating empty or incomplete memory dump files.

 $writemem("a", a, 1, 0);

now aborts with an error message instead of creating an empty dump file.

I tested the attached patch with 'make test_regress' only, as I don't use $writemem() myself.
Please review.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-05-14T10:35:37Z


Well done, thanks for the good work.

Fixed in git towards 4.016.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-06-16T13:58:37Z


In 4.016.

@veripoolbot veripoolbot added area: configure/compiling Issue involves configuring or compilating Verilator itself resolution: fixed Closed; fixed labels Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: configure/compiling Issue involves configuring or compilating Verilator itself resolution: fixed Closed; fixed
Projects
None yet
Development

No branches or pull requests

1 participant