Repository navigation
eZ80 corpus: sandbox stubs on the eZ80 assert path, target-aware sizeof expectations, stub label fix - #377
Merged
Conversation
#375 gave the forced-z80 assert sandbox appended/inserted zero-return stubs for call targets with no executable body, but the eZ80 runner (EZ80AssertEach) assembled the product body as-is. An addressless @extern keeps a bare label there too, so the sandbox assert of examples/nanz/canvas_house.nanz fell through the canvas_* labels into unrelated code and hit the cycle limit: "no return after 400000000 cycles (PC $040027)". The stub body (XOR A / LD L,A / LD H,A / RET) is valid ADL text, so the same withAssertSandboxStubs pass covers both. Product output is untouched: the pass runs only on the body the assert runner assembles, never on Steps.Assembly or Steps.EZ80Body. Regression test: pkg/pipeline TestEZ80AssertSandboxStubsUndefinedExtern (product keeps the bare label; the eZ80 sandbox assert passes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N957godRAhTkyy1mTB6roS
Five eZ80 assert-corpus fails are target-dependent facts, not compiler bugs (ADR 0054 §2/§3): - sizeof_test.c 22, c99_enum_typedef.c 68, c99_pointers.c 73: sizeof a pointer is 2 on the Z80, 3 under the eZ80 ADL pointer ABI. - 30_stream_test.nanz (first/seq byte): the program stores &buf into a u16 cell, which under the 24-bit ABI truncates the bank byte, so the write lands in bank 0 (unwritable on the Agon) and buf stays 0. The compiled code matches the specification exactly (bufstream_init does two byte stores, LD (IX+0),E / LD (IX+1),D); the Z80 verdicts still pass against the original expectations. Both frontends now accept an optional per-target expectation after the normal one: "assert f() == 2 ez80 = 3" (Nanz) and "// assert f() == 2 ez80 = 3" (C // assert comment). hir.Assert gains ExpectedEZ80 (*int64, nil = use Expected); only the eZ80 verdict paths consult it — checkEZ80AssertResult and the ez80_asserts harness's fab verdict — so Z80, Z80N, mir2 and wasm behaviour is unchanged, and compile_sweep shows Z80 output byte-identical to main (the only exit changes are the four edited corpus sources, which the main binary rejects as malformed directives because it predates the syntax; the candidate compiles their original and edited texts to identical .a80). The 30_stream_test.nanz edit refreshes its pinned record in docs/grace-integration-338/reviewed-updates.json (source_sha256 + boundary note) per the reviewed-catalog workflow. Regression tests: pkg/nanz TestParseAssertEZ80Override (clause, via interaction, nil default, truncated clause is an error), pkg/c89 TestAssertEZ80Override (hex/negative/comment forms, malformed refused), pkg/pipeline TestEZ80AssertTargetExpectation (Z80 runs against Expected == 2 and passes, eZ80 runs against the override == 3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N957godRAhTkyy1mTB6roS
…y defines The pass recognised only "name:" lines as label definitions, so two shapes that define a symbol differently gained a duplicate stub and the program stopped assembling: - "tag: DS 2, 0" — a data label whose body is on the same line; - "node_tag EQU peek" — a function alias (examples/nanz/ self_lanz_parser.nanz), assembled as "label 'node_tag' already defined" once the eZ80 assert path (previous commit) ran the pass over that corpus body. The same bug is latent for the forced-z80 sandbox (examples/nanz/self_parser.nanz, self_lanz_parser.nanz). Both shapes now mark the symbol defined: cutAsmLabelDef splits the leading label from a same-line body, and "name EQU expr" lines count as definitions. Bare labels keep the previous next-line lookahead. Regression tests: TestAssertSandboxStubsDataLabelWithSameLineBody, TestAssertSandboxStubsEQUAliasNotStubbed (both expect the text passed through unchanged); self_lanz_parser/self_parser eZ80 asserts verified back to pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N957godRAhTkyy1mTB6roS
The stable pipeline requires every pkg/pipeline test in the profile manifest exactly once; the four new tests (sandbox-stub label/EQU recognition, eZ80 sandbox stubs, eZ80 target-aware expectation) run in seconds and belong in fast. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N957godRAhTkyy1mTB6roS
The example stores a 24-bit pointer in a u16 cell, so on eZ80 it is not portable code; an 'ez80 = 0' expectation would enshrine the broken result. Restore the original source and its reviewed-updates record; the two asserts stay as known eZ80 failures until the example is rewritten portably. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N957godRAhTkyy1mTB6roS
PR tests: 🟢 passCommit:
Deep pipeline domains and the full assertion corpus run on release tags, nightly and manual audits. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Triage of the eZ80 assert-corpus failures on main: 5 fail and 1 crash.
Changes
canvas_house.nanz:129(crash), a harness bug. The eZ80 assert program was assembled without the assert-sandbox stubs that Fix the 7 failing corpus asserts (Frill parse/types, ObjC vtables on Z80, host externs in the assert sandbox) #375 added to the Z80 path, so calls to bare@extern canvas_*labels fell through into unrelated code. The same stubs, which are valid ADL code, now apply to the eZ80 assert program. Product output keeps the bare labels.sizeof(pointer)asserts, target-dependent by design. These aresizeof_test.c:21,c99_enum_typedef.c:67andc99_pointers.c:72. A pointer is 3 bytes under the eZ80 ADL ABI (ADR 0054) and 2 on the Z80, and the compiled code is correct.assert f() == 2 ez80 = 3in Nanz, and// assert f() == 2 ez80 = 3in C comments.hir.Assert.ExpectedEZ80field is read only by the eZ80 verdict paths. Z80, Z80N, mir2 and wasm are unchanged.withAssertSandboxStubslabel recognition. Same-line data labels (tag: DS 2, 0) and EQU aliases are no longer stubbed again. This fixes 7 Z80-reference asserts that errored on main.30_stream_test.nanz:63,75left failing on purpose. The example stores a 24-bit pointer in a u16 cell, which is not portable to eZ80. Anez80 = 0expectation would enshrine the broken result, so the two asserts stay visible as known eZ80 failures until the example is rewritten.Gates
sizeoffailures are fixed. The only failures left are the two30_stream_testasserts.go testfor nanz, c89, hir and the pipeline eZ80/ADL/sandbox tests is ok, and the fast profile passes.Co-developed with a GLM worker session (claude-z). The coordinator reviewed it and reverted the
30_stream_testexpectation.🤖 Generated with Claude Code
https://claude.ai/code/session_01N957godRAhTkyy1mTB6roS