Fix VPI iteration over hierarchy (#5314) (#5731)

This commit is contained in:
Natan Kreimer 2025-01-13 14:40:34 +02:00 committed by GitHub
parent dc43071f1c
commit 20faa99464
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -156,6 +156,7 @@ Mladen Slijepcevic
Morten Borup Petersen
Mostafa Gamal
Nandu Raj
Natan Kreimer
Nathan Graybeal
Nathan Kohagen
Nathan Myers

View File

@ -181,7 +181,6 @@ class EmitCSyms final : EmitCBaseVisitorConst {
/// Then add/update entry in m_scopeNames if not already there
void varHierarchyScopes(string scp) {
// we want no result to be -1, so use ints
string::size_type prd_pos = scp.rfind('.');
string::size_type dot_pos = scp.rfind("__DOT__");
@ -195,7 +194,7 @@ class EmitCSyms final : EmitCBaseVisitorConst {
}
// resize and advance pointers
if (prd_pos < dot_pos && dot_pos != string::npos) {
if ((prd_pos < dot_pos || prd_pos == string::npos) && dot_pos != string::npos) {
scp.resize(dot_pos);
dot_pos = scp.rfind("__DOT__");
} else {