-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Communicate to llvm/gcc that refcount and index errors are very unlik…
…ely. Make refcount errors fatal.
- Loading branch information
1 parent
71e5e42
commit cc81618
Showing
2 changed files
with
13 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
module neat.runtime.array; | ||
|
||
extern(C) void neat_runtime_index_oob(size_t index); | ||
|
||
size_t checkIndex(size_t index, size_t length) { | ||
// < 0 overflows to >= length. | ||
if (index >= length) { | ||
import neat.runtime.stdlib : exit, fprintf, stderr; | ||
|
||
fprintf(stderr, "Array index out of bounds: %zd\n".ptr, index); | ||
exit(1); | ||
neat_runtime_index_oob(index); | ||
} | ||
return index; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters