Browse Source

Fix constant out of bounds bug

gingerBill 6 years ago
parent
commit
34b6486361
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/check_expr.cpp

+ 2 - 2
src/check_expr.cpp

@@ -2703,9 +2703,9 @@ bool check_index_value(CheckerContext *c, bool open_range, Ast *index_value, i64
 			if (value) *value = v;
 			bool out_of_bounds = false;
 			if (open_range) {
-				out_of_bounds = v > max_count+1;
+				out_of_bounds = v >= max_count+1;
 			} else {
-				out_of_bounds = v > max_count;
+				out_of_bounds = v >= max_count;
 			}
 			if (v < 0) {
 				out_of_bounds = true;