From a0b1272a628371b92020f15eb69a41c753b6b99e Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Tue, 9 Oct 2007 21:19:38 -0700 Subject: [PATCH] Fix signed/unsigned warnings Fixed some signed/unsigned warnings, including one that caused an actual runtime error if not dealt with safely. Signed-off-by: Stephen Williams --- elab_expr.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elab_expr.cc b/elab_expr.cc index 0970bd2c8..cf4470b93 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -406,7 +406,7 @@ NetExpr* PECallFunction::elaborate_sfunc_(Design*des, NetScope*scope, int expr_w NetExpr*sub = expr->elaborate_expr(des, scope, -1, true); sub->cast_signed(false); - if (expr_wid > sub->expr_width()) + if (expr_wid > 0 && (unsigned)expr_wid > sub->expr_width()) sub = pad_to_width(sub, expr_wid); return sub; @@ -1264,7 +1264,7 @@ NetExpr* PEIdent::elaborate_expr_net_word_(Design*des, NetScope*scope, // Recalculate the constant address with the adjusted base. unsigned use_addr = net->array_index_to_address(addr); - if (use_addr != addr) { + if (addr < 0 || use_addr != (unsigned long)addr) { verinum val (use_addr, 8*sizeof(use_addr)); NetEConst*tmp = new NetEConst(val); tmp->set_line(*this);