diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-13 08:43:17 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-13 08:43:17 +0000 |
| commit | c6dbd14ec8ff94df47d3c2137cc5234203ec5e0c (patch) | |
| tree | 6e07a8384d28c9a92ca56e9cb2dca2017b1817cb /AGENTS | |
| parent | 56f17f199ee2bc0a77e090c43dd367f43c909f2c (diff) | |
fix: check division and modulo for zero divisors
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'AGENTS')
| -rw-r--r-- | AGENTS/SUBSYSTEMS.md | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/AGENTS/SUBSYSTEMS.md b/AGENTS/SUBSYSTEMS.md index 0075222..d4d1189 100644 --- a/AGENTS/SUBSYSTEMS.md +++ b/AGENTS/SUBSYSTEMS.md @@ -51,10 +51,11 @@ FileHandler, is deliberately ignorant of user kinds). The enum range check after producer (constants, same-name copies, zero-init, memset-0 arrays) is valid by construction, which is why 0-based ordinals are load-bearing. -**Runtime checks** (`RuntimeCheck`): only array bounds checking and the file checks are -actually wired up. `emitDivZeroCheck` exists but has **zero call sites** — division by -zero (for `/`, DIV and MOD) is currently unchecked; the TODO sits in -`ArithmeticHandler.cc`. The public `emitErrorAndExit(Cond, Msg, ArrayRef<Value*>)` +**Runtime checks** (`RuntimeCheck`): array bounds, file misuse, enum ranges, null +dereferences and array-parameter bounds contracts are checked at their emit sites. +`ArithmeticHandler` calls `emitDivZeroCheck` before `/`, DIV and MOD; the check accepts +i64 and double divisors, including both floating-point signed zeros, and exits with +a `[Fatal]` diagnostic and status 1. The public `emitErrorAndExit(Cond, Msg, ArrayRef<Value*>)` overload exists for failure sites whose printf arguments (line, filename) are runtime values — FileHandler's helpers use it; the private compile-time-line form delegates to it. |
