Skip to content
New issue

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

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

Already on GitHub? # to your account

memory_libmap: update indices on design modification #4892

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

widlarizer
Copy link
Collaborator

As reported in #4883, indices to the pass are reused after the module is modified, leading to dangling cell pointers in ModWalker etc. This has been the case since the inception of the pass but has only recently been discovered when 901935f exposed the issue as a segfault when a PortBit is hashed. This issue is easily detected with valgrind but since there's limited use of valgrind in testing (vgtest Makefile target only runs simple tests due to the runtime, for example) we've missed it. Whether this has lead to incorrect mapping results is uncertain.

This PR fixes the issue by rebuilding MapWorker but only when a memory actually gets emitted modifying the design. This rebuilds all the indices used in the and resolves anything detectable by valgrind at least on a clang debug build.

For testing with the segfault repro, see #4883 and run yosys with valgrind like valgrind yosys -p "read_verilog ...

@widlarizer widlarizer merged commit df3c62a into main Feb 12, 2025
43 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant