From fac07970e631605abb77bc48c9351404c69cee70 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 12 Apr 2026 18:12:41 -0400 Subject: [PATCH] Improve too-small cast warning to show size --- src/V3Width.cpp | 2 +- test_regress/t/t_cast_size_bad.out | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/V3Width.cpp b/src/V3Width.cpp index b9b0eb0c6..6a6213471 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -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()); diff --git a/test_regress/t/t_cast_size_bad.out b/test_regress/t/t_cast_size_bad.out index 59bc68f3b..f0ecfdff7 100644 --- a/test_regress/t/t_cast_size_bad.out +++ b/test_regress/t/t_cast_size_bad.out @@ -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); | ^