-
Notifications
You must be signed in to change notification settings - Fork 544
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 assertion failure in V3Gate #5101
base: master
Are you sure you want to change the base?
Conversation
…BJ(!substitutions.empty(),...) may fail when an AstNode unluckily allocated to the same address of the deleted AstNode.
Thanks for tracking this down. The need for this fix causes me concern. If I'm reading this right, the first thing we do in that with the driver of the variable is commit all the pending substitution: Lines 761 to 768 in 298e0f2
The first thing that does is it removes the pointer from Lines 689 to 690 in 298e0f2
After that, the only place where it can be added back is here, where we check the sinks (consumers) of the variable: Line 825 in 298e0f2
For However, this condition just above, is there precisely to prevent such substitution (where you would substitute the driver logic into itself): Lines 810 to 819 in 298e0f2
Could you check if this is indeed the case ( |
I added I'll dump and check the AST tomorrow. |
I added Lines 799 to 800 in 298e0f2
The AstVarScope is not used at all, it is just declared, but not referred. In _051_split.tree which is just before V3Gate, the AstVarScope is referred both as LV and RV. |
V3Gate has several unique steps (see |
verilator/src/V3Gate.cpp
Lines 683 to 684 in 298e0f2
A registered AstNode in
m_hasPending
remains even after it is deleted.verilator/src/V3Gate.cpp
Line 846 in 298e0f2
If a newly created AstNode is allocated to the same address as the deleted one, a check in line 693 fails because early exit in line 690 does not work;
m_hasPending
has the entry for the AstNode though it is for the deleted AstNode.verilator/src/V3Gate.cpp
Lines 689 to 693 in 298e0f2
I could not make a small test to reproduce this.