From 610dedc2b85b21c34841986a03d77da3728aa203 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 4 Oct 2008 21:19:27 +0100 Subject: [PATCH] Fix for pr2146824. Currently, a bitwise boolean operator will cause the expression width to be reduced to the size of the result. This can give rise to incorrect results. This patch changes the behaviour to take into account the required precision for calculating the two operands. --- set_width.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/set_width.cc b/set_width.cc index cb736cea0..24a6f8df0 100644 --- a/set_width.cc +++ b/set_width.cc @@ -122,7 +122,10 @@ bool NetEBBits::set_width(unsigned w, bool) /* */ unsigned use_width = w; - + if (left_->expr_width() > use_width) + use_width = left_->expr_width(); + if (right_->expr_width() > use_width) + use_width = right_->expr_width(); /* If the operands end up too small, then pad them to suit. */