Skip to content

Commit

Permalink
Fix infinite loop when analyzing invalid net alias expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
MikePopoloski committed Nov 24, 2024
1 parent 2be8c63 commit fed2ddf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/ast/symbols/MemberSymbols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2460,7 +2460,7 @@ std::span<const Expression* const> NetAliasSymbol::getNetReferences() const {
}

netRefs = buffer.copy(scope->getCompilation());
if (issuedError)
if (issuedError || netAliases.empty())
return *netRefs;

// Compare every net alias expression to every other, finding the set of
Expand Down
9 changes: 9 additions & 0 deletions tests/unittests/ast/MemberTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2404,3 +2404,12 @@ endmodule
compilation.addSyntaxTree(tree);
NO_COMPILATION_ERRORS;
}

TEST_CASE("Net alias infinite loop regress") {
auto tree = SyntaxTree::fromText(R"(
alias;
)");

Compilation compilation;
compilation.addSyntaxTree(tree);
}

0 comments on commit fed2ddf

Please sign in to comment.