8000 Fix segfault on using type in parameterized classes without #() (#4281) by donlon · Pull Request #4440 · verilator/verilator · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix segfault on using type in parameterized classes without #() (#4281) #4440

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

Merged
merged 4 commits into from
Aug 26, 2023

Conversation

donlon
Copy link
Contributor
@donlon donlon commented Aug 26, 2023

This issue (#4281) is basically caused by two factors.

The first is that the code contains reference to a type declared inside a parameterized class (C::a_ch_t) and this should be reported as a "Reference to parameterized class without #() (IEEE 1800-2017 8.25.1)" error in V3LinkDot. However, the LinkDotResolverVisitor::visit(AstRefDType* nodep) mistakenly treat it as a normal class reference, so the type is resolved and the AstClassOrPackageRef is removed, preventing it from entering the checking function (LinkDotResolverVisitor::visit(AstClassOrPackageRef* nodep)) to emit the error. After it goes to V3Param, since the AstClassOrPackageRef was removed, V3Param may regard the referenced class as unused and then remove it, which caused the later segfault.

Beside, the use of user2p in V3Param conflicts with the constant simulation function. It's now replaced with user4p to prevent any errors.

@donlon donlon changed the title Fix segfault on using type in parameterized classes without #() #4281 Fix segfault on using type in parameterized classes without #() (#4281) Aug 26, 2023
Copy link
Member
@wsnyder wsnyder left a comment

Choose a reason for hiding this comment

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

Great work, the param code can be hard to dig into.

It looks like a VNUser2InUse was missing, if it wasn't that should have found the user conflict.

Co-authored-by: Wilson Snyder <wsnyder@wsnyder.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0