Fix subarray access condition
authorLukasz Dalek <ldalek@antmicro.com>
Fri, 17 Jul 2020 12:37:44 +0000 (14:37 +0200)
committerLukasz Dalek <ldalek@antmicro.com>
Mon, 3 Aug 2020 14:16:04 +0000 (16:16 +0200)
Signed-off-by: Lukasz Dalek <ldalek@antmicro.com>
frontends/ast/simplify.cc

index 66f22e1135ebc4469f43389371b03dbf6c295061..a166f8a8951b29167627770e622b98a40f1905aa 100644 (file)
@@ -1478,7 +1478,7 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
 
                for (int i = 0; 2*i < GetSize(id2ast->multirange_dimensions); i++)
                {
-                       if (GetSize(children[0]->children) < i)
+                       if (GetSize(children[0]->children) <= i)
                                log_file_error(filename, location.first_line, "Insufficient number of array indices for %s.\n", log_id(str));
 
                        AstNode *new_index_expr = children[0]->children[i]->children.at(0)->clone();