aboutsummaryrefslogtreecommitdiff
path: root/AGENTS
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-22 15:06:13 +0000
committer_ov4 <ov4@ov4.org>2026-10-22 15:21:11 +0000
commitfa83b7df5a0711bf5f4a5162cc33b0a4123a53c7 (patch)
treedcfd24756256fcef21c43f19aa6e914455435806 /AGENTS
parent353c38e23108856daa2c5d0e86443ac5136dcaa7 (diff)
fix(arrays): reject inverted bounds and check array allocation
Constant inverted bounds are a compile error and other bounds are checked at run time. Allocation sizes use overflow-checked arithmetic, and a NULL malloc (including the BYVAL copy) reports that the array is too large. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'AGENTS')
-rw-r--r--AGENTS/SUBSYSTEMS/ARRAYS.md4
1 files changed, 4 insertions, 0 deletions
diff --git a/AGENTS/SUBSYSTEMS/ARRAYS.md b/AGENTS/SUBSYSTEMS/ARRAYS.md
index 188ff5b..cc104a5 100644
--- a/AGENTS/SUBSYSTEMS/ARRAYS.md
+++ b/AGENTS/SUBSYSTEMS/ARRAYS.md
@@ -10,6 +10,10 @@ parameter binding/arguments in `ArrayParameters.cc`, and output in `ArrayOutput.
- A DECLAREd array is one malloc'd flat buffer (memset to zero), row-major, any rank,
any bounds.
+- Every dimension needs `upper >= lower`: constant bounds are a compile error, other
+ bounds a runtime error (`emitCheckedByteSize`). The byte size is computed with
+ `llvm.{ssub,umul}.with.overflow`; overflow or a NULL malloc (also the BYVAL copy)
+ reports `Array X is too large`. Arrays therefore always have at least one element.
- Bounds and multipliers are *SSA values* cached in `ArrayMetadata`.
- `ArrayTable` is scoped per function (`exchangeTable`, driven from CodeGen's
`FunctionDefAST` branch, mirroring the Symbols discipline).