Fixed AstNode::mkconst_bits() segfault on zero-sized constant

This commit is contained in:
Clifford Wolf 2015-09-24 11:21:20 +02:00
parent e2e092b144
commit 1b8cb9940e
1 changed files with 1 additions and 1 deletions

View File

@ -699,7 +699,7 @@ AstNode *AstNode::mkconst_bits(const std::vector<RTLIL::State> &v, bool is_signe
for (size_t i = 0; i < 32; i++) { for (size_t i = 0; i < 32; i++) {
if (i < node->bits.size()) if (i < node->bits.size())
node->integer |= (node->bits[i] == RTLIL::S1) << i; 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->integer |= (node->bits.back() == RTLIL::S1) << i;
} }
node->range_valid = true; node->range_valid = true;