From 4d2e2b676ee40abb6123b36b5baf0911732954cb Mon Sep 17 00:00:00 2001 From: Drew T <50529377+Druthulu@users.noreply.github.com> Date: Thu, 1 Oct 2026 11:08:22 -0600 Subject: [PATCH] T2.c1: add kept-cast macro set (CAST_ALIAS/SIGN/WIDTH/MISALIGNED/NONSTRUCT) to common.h --- include/common.h | 17 +++++++++++++++++ phase-ends/current/discussions/INDEX.md | 2 +- phase-ends/current/logs/T2.c1.md | 24 ++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 phase-ends/current/logs/T2.c1.md diff --git a/include/common.h b/include/common.h index 2be727d609..e9a35e2161 100644 --- a/include/common.h +++ b/include/common.h @@ -60,6 +60,23 @@ typedef s64 M2C_UNK64; #define LOW(x) (*(s32 *)&(x)) #define LOWU(x) (*(u32 *)&(x)) +/* Kept-cast macros (Phase 39 T2, 2026-10-01): the cast campaign's ONLY spelling for a `*(T *)(p + k)` the byte gate + * refuses as a member. Each expands to the identical cast (same expression tree, same bytes; one make-check IDENTICAL + * per macro recorded in phase-ends/current/tasks/T2.md) and names ONE cause class. `type_census --check-casts` counts a + * site by macro name and demands its restruct ledger row (rung S, site verdict KEPT(), R99/R100); a cast outside + * this set is raw and fails the gate. M2C_FIELD above stays raw (form M). The lvalue reinterpretations LOBU..LOWU above + * are the set's sixth class, REINTERP. + * CAST_ALIAS SCHED-ALIAS member spelling (/s) moves the scheduler or cse (cookbook §458) + * CAST_SIGN SIGN the access's sign differs from the field the layout holds + * CAST_WIDTH WIDTH overlap loser: a second width at an offset whose layout holds another width + * CAST_MISALIGNED MISALIGNED the offset is not a multiple of the access width + * CAST_NONSTRUCT NON-STRUCT the base is arithmetic, not an object the struct map explains */ +#define CAST_ALIAS(T, p, k) (*(T *)((p) + (k))) +#define CAST_SIGN(T, p, k) (*(T *)((p) + (k))) +#define CAST_WIDTH(T, p, k) (*(T *)((p) + (k))) +#define CAST_MISALIGNED(T, p, k) (*(T *)((p) + (k))) +#define CAST_NONSTRUCT(T, p, k) (*(T *)((p) + (k))) + #include "gte_inline.h" /* Phase 36 T5: the GTE coprocessor macros, one definition each */ #include "struct_types.h" /* Phase 38 T3: the struct map's canonical layouts, one definition each, visible to every space */ #endif /* COMMON_H */ diff --git a/phase-ends/current/discussions/INDEX.md b/phase-ends/current/discussions/INDEX.md index 548356d6eb..4d77ef1322 100644 --- a/phase-ends/current/discussions/INDEX.md +++ b/phase-ends/current/discussions/INDEX.md @@ -1,3 +1,3 @@ # Discussions -- one line per record # id | topic | date | status | path -I1 | Phase 3.39 first task: regenerate the timeline and README after the 3.38 close (tools/timeline.py; tools/progress.py --r | 2026-10-01 | now | phase-ends/current/discussions/inbox-20261001-101339.md +I1 | Phase 3.39 first task: regenerate the timeline and README after the 3.38 close (tools/timeline.py; tools/progress.py --r | 2026-10-01 | planned:3.39/T1 | phase-ends/current/discussions/inbox-20261001-101339.md diff --git a/phase-ends/current/logs/T2.c1.md b/phase-ends/current/logs/T2.c1.md new file mode 100644 index 0000000000..bab5325b17 --- /dev/null +++ b/phase-ends/current/logs/T2.c1.md @@ -0,0 +1,24 @@ +# T2.c1 — kept-cast macro set in include/common.h + +## Change +- include/common.h:62-78: inserted the brief's block (comment + CAST_ALIAS/SIGN/WIDTH/MISALIGNED/NONSTRUCT) between `#define LOWU(x)` and `#include "gte_inline.h"`. M2C_FIELD, LOBU..LOWU untouched. + +## Timeline +1. Edit common.h (Edit tool). +2. Temporary respell of the 5 proof sites via `.run/t2c1_respell.py` (asserts each raw expr on its line, replaces first occurrence). Sites confirmed before edit: + - src/ov_SC05_010/ov_SC05_010_jr_80180F84.c:3006 → `CAST_ALIAS(u16, D_801C7E30, 0x34) = 0;` + - src/ov_SC01_000/ov_SC01_000_after.c:2682 → `(s32)CAST_SIGN(s16, arg0, 0xF4)` + - src/ov_SC01_000/ov_SC01_000_jr_801734BC.c:2582 → first `*(s16 *)(param_1 + 8)` (the arg, not the `*(s32 *)` lvalue) → `CAST_WIDTH(s16, param_1, 8)` + - src/ov_SC01_000/ov_SC01_000_jr_8012ACE0.c:2624 → `CAST_MISALIGNED(int, param_1, 6)` + - src/ov_SC01_000/ov_SC01_000_jr_8012ACE0.c:795 → `CAST_NONSTRUCT(s16, ((s32 *)arg0)[8], 0x1A) = 0x1000;` +3. `bash tools/run.sh t2_proof_sc01 -- make check BINARY=ov_SC01_000` (.run/logs/t2_proof_sc01.log) → exit 0; CC lines present for _after.o, _jr_801734BC.o, _jr_8012ACE0.o: + `[ OK ] build/ov_SC01_000/ov_SC01_000` / `sha1 9052dc0e4540db6d9c258c5e063e558c31867492 == config/check.ov_SC01_000.sha (BYTE-IDENTICAL)` +4. `bash tools/run.sh t2_proof_sc05 -- make check BINARY=ov_SC05_010` (.run/logs/t2_proof_sc05.log) → exit 0; CC line present for _jr_80180F84.o: + `[ OK ] build/ov_SC05_010/ov_SC05_010` / `sha1 9b5a70f97e6de537ddab83491c0b35ab137ddb2a == config/check.ov_SC05_010.sha (BYTE-IDENTICAL)` +5. `git checkout --` the 4 src files (brief said three; sites span four files) → `git status --short -- src` empty. +6. R22: `bash tools/run.sh --bg t2_r22 -- bash -c 'make clean && make extract-all JOBS=16 && make check-all JOBS=16'` + `--wait t2_r22 --max 280` (.run/logs/t2_r22.log) → exit=0, `check-all: 218 passed, 0 failed of 218`. +7. Commit include/common.h via commit_task.sh T2.c1. + +## Notes +- harness: a bash command naming a >20k .c file in `grep -c` was denied by the whole-read guard; edits done by a scratch Python script instead. +- Proofs per macro: SC01 proof covers SIGN, WIDTH, MISALIGNED, NONSTRUCT; SC05 covers ALIAS.