Brummel
04f75c8b71
test(codegen): RED-pin #49 Str leg — heap-Str loop binder must not leak across recur
...
A heap-Str accumulator threaded through a `(loop …)`/`recur` as a loop
binder leaks: each iteration's superseded `str_concat` slab is never
RC-dec'd, even when the loop's final result is consumed. The fixture
reports `allocs=4 frees=1 live=3` under AILANG_RC_STATS (stdout `xyyy`
is correct).
Root (data-flow traced): the `Term::Recur` arm in
crates/ailang-codegen/src/lib.rs (~2131) gates its superseded-value dec
behind `!is_str`. That exclusion exists because a `Str` loop seed may be
a static-literal Str — a constexpr GEP into a packed-struct global with
no rc_header (lib.rs:1612) — and `ailang_rc_dec` on a static pointer
reads garbage at `payload-8` and aborts on underflow (rc.c:221, no
runtime guard, per design/contracts/0011-str-abi.md). So the Str binder's
prior heap slab is overwritten by a plain `store` with no dec.
Distinct from the loop-RESULT scope-close drop (8bcdae1 , which also
excluded Str) and from the ADT leg already fixed in f488d31 — this is
the per-iteration leak of the *intermediate* Str binder values, which
f488d31 explicitly left open pending a representation decision.
RED test crates/ail/tests/loop_recur_str_binder_no_leak_pin.rs with
fixture examples/loop_recur_str_binder_no_leak_pin.ail: the Str leg
asserts live=0 (RED at HEAD, live=3); the ADT leg (f488d31 ) is re-pinned
as a green guard so a regression on the shared Term::Recur dec path is
caught with it.
GREEN side (chosen direction): promote a static-literal Str seed to heap
via str_clone at loop entry so every Str binder slot holds a heap Str
with a valid rc_header, then lift the `!is_str` recur-dec exclusion. This
UPHOLDS the 0011-str-abi codegen-proof invariant (extends "static Str
never reaches dec" to the loop case) rather than adding a runtime guard.
refs #49
2026-05-31 04:09:44 +02:00
..
2026-05-30 18:29:00 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 01:16:21 +02:00
2026-05-28 19:00:12 +02:00
2026-05-28 19:00:12 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-14 02:12:34 +02:00
2026-05-07 11:07:36 +02:00
2026-05-13 12:43:10 +02:00
2026-05-14 02:12:34 +02:00
2026-05-14 02:12:34 +02:00
2026-05-14 02:12:34 +02:00
2026-05-21 12:22:45 +02:00
2026-05-14 02:12:34 +02:00
2026-05-28 14:43:03 +02:00
2026-05-12 14:20:27 +02:00
2026-05-28 14:43:03 +02:00
2026-05-21 01:16:21 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-18 21:16:41 +02:00
2026-05-18 21:16:41 +02:00
2026-05-18 23:28:52 +02:00
2026-05-18 23:28:52 +02:00
2026-05-18 14:32:39 +02:00
2026-05-18 21:16:41 +02:00
2026-05-18 14:50:27 +02:00
2026-05-18 14:50:27 +02:00
2026-05-18 14:50:27 +02:00
2026-05-18 21:16:41 +02:00
2026-05-18 21:16:41 +02:00
2026-05-18 21:16:41 +02:00
2026-05-18 21:16:41 +02:00
2026-05-18 14:50:27 +02:00
2026-05-18 14:32:39 +02:00
2026-05-18 21:16:41 +02:00
2026-05-28 13:31:31 +02:00
2026-05-21 01:16:21 +02:00
2026-05-14 02:12:34 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-30 12:21:27 +02:00
2026-05-30 12:21:27 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-14 02:12:34 +02:00
2026-05-14 02:12:34 +02:00
2026-05-21 12:22:45 +02:00
2026-05-12 14:20:27 +02:00
2026-05-14 02:12:34 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-29 17:21:32 +02:00
2026-05-14 02:12:34 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-14 02:12:34 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-17 23:57:46 +02:00
2026-05-18 01:04:19 +02:00
2026-05-17 23:33:43 +02:00
2026-05-30 17:14:07 +02:00
2026-05-30 17:48:51 +02:00
2026-05-31 04:09:44 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 01:16:21 +02:00
2026-05-14 02:12:34 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 12:22:45 +02:00
2026-05-14 02:12:34 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-14 02:12:34 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 01:16:21 +02:00
2026-05-18 11:06:17 +02:00
2026-05-14 02:12:34 +02:00
2026-05-21 12:22:45 +02:00
2026-05-28 14:43:03 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-14 02:12:34 +02:00
2026-05-14 02:12:34 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-29 17:56:10 +02:00
2026-05-14 01:38:41 +02:00
2026-05-21 12:22:45 +02:00
2026-05-14 01:51:50 +02:00
2026-05-21 11:59:38 +02:00
2026-05-21 11:59:38 +02:00
2026-05-30 17:48:34 +02:00
2026-05-30 17:48:34 +02:00
2026-05-30 00:49:51 +02:00
2026-05-30 17:13:56 +02:00
2026-05-30 10:41:52 +02:00
2026-05-30 00:49:51 +02:00
2026-05-30 00:49:51 +02:00
2026-05-30 17:14:28 +02:00
2026-05-31 02:05:02 +02:00
2026-05-31 02:05:02 +02:00
2026-05-30 00:49:51 +02:00
2026-05-14 02:12:34 +02:00
2026-05-14 02:12:34 +02:00
2026-05-14 02:12:34 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 01:16:21 +02:00
2026-05-14 02:12:34 +02:00
2026-05-21 01:16:21 +02:00
2026-05-14 02:12:34 +02:00
2026-05-14 02:12:34 +02:00
2026-05-14 02:12:34 +02:00
2026-05-14 02:12:34 +02:00
2026-05-14 02:12:34 +02:00
2026-05-14 02:12:34 +02:00
2026-05-14 02:12:34 +02:00
2026-05-21 01:16:21 +02:00
2026-05-21 01:16:21 +02:00
2026-05-20 20:51:53 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-13 11:12:48 +02:00
2026-05-21 12:22:45 +02:00
2026-05-28 14:43:03 +02:00
2026-05-28 14:43:03 +02:00
2026-05-28 14:43:03 +02:00
2026-05-12 14:20:27 +02:00
2026-05-28 14:43:03 +02:00
2026-05-28 14:43:03 +02:00
2026-05-28 14:43:03 +02:00
2026-05-28 14:43:03 +02:00
2026-05-28 14:43:03 +02:00
2026-05-12 14:20:27 +02:00
2026-05-28 14:43:03 +02:00
2026-05-12 14:20:27 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 12:22:45 +02:00
2026-05-21 01:16:21 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-10 22:35:37 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 03:31:40 +02:00
2026-05-09 17:50:29 +02:00
2026-05-09 17:45:27 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 01:11:56 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-21 12:22:45 +02:00
2026-05-14 02:12:34 +02:00
2026-05-14 02:12:34 +02:00
2026-05-13 11:12:48 +02:00
2026-05-14 02:12:34 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-14 02:12:34 +02:00
2026-05-14 02:12:34 +02:00
2026-05-11 01:46:58 +02:00
2026-05-28 14:43:03 +02:00
2026-05-11 01:46:58 +02:00
2026-05-21 12:57:06 +02:00
2026-05-13 11:12:48 +02:00
2026-05-14 02:12:34 +02:00
2026-05-13 11:12:48 +02:00
2026-05-14 02:12:34 +02:00
2026-05-21 01:16:21 +02:00
2026-05-17 23:33:43 +02:00
2026-05-17 23:33:43 +02:00
2026-05-17 23:33:43 +02:00
2026-05-17 23:33:43 +02:00
2026-05-21 12:22:45 +02:00
2026-05-13 11:12:48 +02:00
2026-05-13 11:12:48 +02:00
2026-05-14 02:12:34 +02:00
2026-05-13 11:12:48 +02:00