Fix infinite loop on some V3Ast internal errors.

This commit is contained in:
Wilson Snyder 2019-12-19 20:07:48 -05:00
parent 9a54b2144b
commit 9807025618

View File

@ -1107,7 +1107,13 @@ void AstNode::v3errorEndFatal(std::ostringstream& str) const {
string AstNode::locationStr() const {
string str = "... In instance ";
const AstNode* backp = this;
int itmax = 10000; // Max iterations before giving up on location search
while (backp) {
if (--itmax < 0) {
// Likely some circular back link, and V3Ast is trying to report a low-level error
UINFO(1, "Ran out of iterations finding locationStr on " << backp << endl);
return "";
}
const AstScope* scopep;
if ((scopep = VN_CAST_CONST(backp, Scope))) {
// The design is flattened and there are no useful scopes