Improve too-small cast warning to show size
This commit is contained in:
parent
be7d26c5be
commit
fac07970e6
|
|
@ -2631,7 +2631,7 @@ class WidthVisitor final : public VNVisitor {
|
|||
if (m_vup->prelim()) {
|
||||
int width = nodep->rhsp()->toSInt();
|
||||
if (width < 1) {
|
||||
nodep->v3error("Size-changing cast to zero or negative size");
|
||||
nodep->v3error("Size-changing cast to zero or negative size: " << width);
|
||||
width = 1;
|
||||
}
|
||||
userIterateAndNext(nodep->lhsp(), WidthVP{SELF, PRELIM}.p());
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%Error: t/t_cast_size_bad.v:14:13: Size-changing cast to zero or negative size
|
||||
%Error: t/t_cast_size_bad.v:14:13: Size-changing cast to zero or negative size: -1
|
||||
: ... note: In instance 't'
|
||||
14 | b = (-1)'(a);
|
||||
| ^
|
||||
|
|
|
|||
Loading…
Reference in New Issue