From 1b8cb9940e7c586b387cb212b4d9b9dbb881d62a Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Thu, 24 Sep 2015 11:21:20 +0200 Subject: [PATCH] Fixed AstNode::mkconst_bits() segfault on zero-sized constant --- frontends/ast/ast.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontends/ast/ast.cc b/frontends/ast/ast.cc index a45859157..5044eeabc 100644 --- a/frontends/ast/ast.cc +++ b/frontends/ast/ast.cc @@ -699,7 +699,7 @@ AstNode *AstNode::mkconst_bits(const std::vector &v, bool is_signe for (size_t i = 0; i < 32; i++) { if (i < node->bits.size()) node->integer |= (node->bits[i] == RTLIL::S1) << i; - else if (is_signed) + else if (is_signed && !node->bits.empty()) node->integer |= (node->bits.back() == RTLIL::S1) << i; } node->range_valid = true; -- 2.30.2