From 8b6ba7222d9990bc19e355eabcf046a7ea773545 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Thu, 22 Oct 2026 15:08:51 +0000 Subject: fix(arrays): free array buffers when their scope ends Register every array as a stack object so its buffer is freed on scope end, re-DECLARE, RETURN and unwinding; run the element-destroy loop only for types that need destruction. Co-Authored-By: Claude Sonnet 5.5 --- AGENTS/PITFALLS/core-language.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'AGENTS/PITFALLS/core-language.md') diff --git a/AGENTS/PITFALLS/core-language.md b/AGENTS/PITFALLS/core-language.md index 60fbd11..0ddba05 100644 --- a/AGENTS/PITFALLS/core-language.md +++ b/AGENTS/PITFALLS/core-language.md @@ -13,7 +13,7 @@ source, most also by compiling and running test programs. - **Arrays cross function boundaries only as parameters.** `ArrayTable` is scoped per function, so referencing another function's array fails cleanly as "Undeclared array". Whole arrays pass as `ARRAY OF T` / `ARRAY[l:u,...] OF T` - parameters (BYVAL copies the entire buffer and never frees it); a whole-array + parameters (BYVAL copies the entire buffer; the copy is freed when the callee ends); a whole-array argument against a scalar parameter is still a compile error. FUNCTIONs cannot RETURN arrays. A whole-array variable is also rejected as an operand or as a value of its element type. -- cgit v1.3.1-4-g156e