From c785c3569f1e4b6a26c1c215c3f9deb112800a63 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 25 Mar 2019 20:42:47 +0000 Subject: [PATCH] Fix `runtime.*_expr_error` error --- core/runtime/internal.odin | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/runtime/internal.odin b/core/runtime/internal.odin index 4fdb01cdf..410cf7ec4 100644 --- a/core/runtime/internal.odin +++ b/core/runtime/internal.odin @@ -286,7 +286,7 @@ bounds_check_error :: proc "contextless" (file: string, line, column: int, index } slice_expr_error :: proc "contextless" (file: string, line, column: int, lo, hi: int, len: int) { - if 0 <= lo && lo <= hi && hi <= len do return; + if 0 <= lo && lo <= hi && lo < len && hi <= len do return; handle_error :: proc "contextless" (file: string, line, column: int, lo, hi: int, len: int) { fd := os.stderr; print_caller_location(fd, Source_Code_Location{file, line, column, "", 0}); @@ -303,7 +303,7 @@ slice_expr_error :: proc "contextless" (file: string, line, column: int, lo, hi: } dynamic_array_expr_error :: proc "contextless" (file: string, line, column: int, low, high, max: int) { - if 0 <= low && low <= high && high <= max do return; + if 0 <= low && low <= high && low < max && high <= max do return; handle_error :: proc "contextless" (file: string, line, column: int, low, high, max: int) { fd := os.stderr; print_caller_location(fd, Source_Code_Location{file, line, column, "", 0});