From c6dbd14ec8ff94df47d3c2137cc5234203ec5e0c Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 13 Oct 2026 08:43:17 +0000 Subject: fix: check division and modulo for zero divisors Co-Authored-By: Claude Fable 5.1 --- AGENTS/SUBSYSTEMS.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'AGENTS') 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)` +**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)` 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. -- cgit v1.3.1-4-g156e