aboutsummaryrefslogtreecommitdiff
path: root/code/runtime.odin
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-09-12 23:16:06 +0100
committerGinger Bill <bill@gingerbill.org>2016-09-12 23:16:06 +0100
commit59fb74d2a2706898cca60e35874ecd2477202e71 (patch)
treea27361bf046115b5bb44c3b9f44b59581e86dc71 /code/runtime.odin
parentd4ba6b546632b3174533a2d099031362f74085e9 (diff)
Fix array bounds checking
Diffstat (limited to 'code/runtime.odin')
-rw-r--r--code/runtime.odin18
1 files changed, 12 insertions, 6 deletions
diff --git a/code/runtime.odin b/code/runtime.odin
index aedcdc9ba..5f42c39c5 100644
--- a/code/runtime.odin
+++ b/code/runtime.odin
@@ -290,17 +290,23 @@ __assert :: proc(msg: string) {
__debug_trap()
}
-__abc_error :: proc(file: string, line, column: int, index, len: int) {
- print(file, "(", line, ":", line, ") Index `", index, "` is of bounds range [0, ", len, ")\n")
+__bounds_check_error :: proc(file: string, line, column: int,
+ index, count: int) {
+ println_err("%(%:%) Index % is out of bounds range [0, %)",
+ file, line, column, index, count)
__debug_trap()
}
-__slice_expr_error :: proc(file: string, line, column: int, low, high, max: int) {
- print(file, "(", line, ":", line, ") Invalid slice indices: [", low, ":", high, ":", max, "]\n")
+__slice_expr_error :: proc(file: string, line, column: int,
+ low, high, max: int) {
+ print_err("%(%:%) Invalid slice indices: [%:%:%]\n",
+ file, line, column, low, high, max)
__debug_trap()
}
-__substring_expr_error :: proc(file: string, line, column: int, low, high: int) {
- print(file, "(", line, ":", line, ") Invalid substring indices: [", low, ":", high, "]\n")
+__substring_expr_error :: proc(file: string, line, column: int,
+ low, high: int) {
+ print_err("%(%:%) Invalid substring indices: [%:%:%]\n",
+ file, line, column, low, high)
__debug_trap()
}