Generate SELRANGE instead of errors for potentially unreachable code (#2625) (#2754)

When using a "if" statement inside an always block, part of the code may
be unreachable. This can be used to avoid errors, but it generated an
error, this commit demotes this to a warning. Partly fixes #2625.
This commit is contained in:
Pierre-Henri Horrein
2021-01-15 07:31:48 -05:00
committed by GitHub
parent fb2c243fc7
commit 3c849d7ce0
7 changed files with 78 additions and 19 deletions
+2 -2
View File
@@ -804,8 +804,8 @@ private:
}
// We're extracting, so just make sure the expression is at least wide enough.
if (nodep->fromp()->width() < width) {
nodep->v3error("Extracting " << width << " bits from only "
<< nodep->fromp()->width() << " bit number");
nodep->v3warn(SELRANGE, "Extracting " << width << " bits from only "
<< nodep->fromp()->width() << " bit number");
// Extend it.
AstNodeDType* subDTypep
= nodep->findLogicDType(width, width, nodep->fromp()->dtypep()->numeric());