From ba08c251333c0002d8cd68d515533ef0614522fd Mon Sep 17 00:00:00 2001 From: Lukasz Dalek Date: Fri, 17 Jul 2020 14:37:44 +0200 Subject: [PATCH] Fix subarray access condition Signed-off-by: Lukasz Dalek --- frontends/ast/simplify.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index 66f22e113..a166f8a89 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -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(); -- 2.30.2