boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

commit 5dbea4132c4faacb1c5a1056b67a75ce698c36bf
parent 0a92484ce7291fd32af9aab2e2b4a7399e57f65b
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Thu, 30 Apr 2026 10:13:38 -0700

tcc-todo update

Diffstat:
Mdocs/TCC-TODO.md | 47+++++++++++++++++++++++++++++++++++------------
1 file changed, 35 insertions(+), 12 deletions(-)

diff --git a/docs/TCC-TODO.md b/docs/TCC-TODO.md @@ -74,11 +74,14 @@ make test SUITE=tcc-cc Result: ```text -13 passed, 139 failed +14 passed, 139 failed ``` -(152 fixtures total; the count dropped by 1 since `068-main-noret` -was retired as part of the host-baseline cleanup.) +(153 fixtures total. `068-main-noret` was retired earlier as part of +the host-baseline cleanup; `134-decl-define-in-ifdef` was added as a +regression for the `pps-cond-stack` promotion fix in cc.scm. The new +fixture passes the cc-built tcc-boot2 path because tcc itself has no +trouble with the shape; cc.scm couldn't compile it before the fix.) Raw run log: @@ -86,6 +89,14 @@ Raw run log: build/aarch64/.work/tests/tcc-cc/full-run.log ``` +Most `store(...); assert fail: 0` lines are now prefixed with a +`vfprintf: skipping second: l` line. That's mes-libc's `vfprintf` +warning that it ignored a second `l` length-modifier in tcc's +`%lld` format strings (vendor/mes-libc/stdio/vfprintf.c:89). The +warning is benign noise from the cc.scm-built tcc-boot2's runtime +libc — not from the failing fixture itself — and it appears in a +fixture's tcc.log because we capture tcc-boot2's stderr there. + Passing fixtures: ```text @@ -102,25 +113,37 @@ Passing fixtures: 026-sizeof-expr 049-init-scalar-global 072-enum-const +134-decl-define-in-ifdef ``` Failure groups from per-fixture `tcc.log` files: | group | count | examples | |------:|------:|----------| -| plain segfault during compile/link | 58 | `006-call-no-args`, `008-pointer-deref`, `011-struct`, `125-anon-union` | -| `store(...); assert fail: 0`, then segfault | 44 | `002-arith`, `004-inc-dec`, `020-switch`, `133-for-continue` | -| `assert fail: vtop[-1].r < VT_CONST && vtop[0].r < VT_CONST`, then segfault | 28 | `007-call-with-args`, `013-call`, `024-globals`, `132-tentative-bss-sizing` | -| compile succeeds, generated program exits wrong | 3 | `019-zext-narrow`, `068-main-noret`, `101-char-escapes` | +| plain segfault during compile/link | 59 | `006-call-no-args`, `008-pointer-deref`, `011-struct`, `125-anon-union` | +| `store(...); assert fail: 0`, then segfault | 43 | `002-arith`, `004-inc-dec`, `020-switch`, `133-for-continue` | +| `assert fail: vtop[-1].r < VT_CONST && vtop[0].r < VT_CONST`, then segfault | 31 | `007-call-with-args`, `013-call`, `015-variadic`, `024-globals`, `076-vararg-recv` | | `too many field init` diagnostic | 3 | `001-kitchen-sink`, `012-struct-ptr`, `053-init-struct-pos` | -| `__builtin_va_start` warning, then segfault | 3 | `015-variadic`, `076-vararg-recv`, `079-vararg-deep` | +| compile succeeds, generated program exits wrong | 2 | `019-zext-narrow`, `101-char-escapes` | | `field expected` diagnostic | 1 | `054-init-struct-desig` | -The important shape is that 137 of 140 failures happen before the +The shape is unchanged: 137 of 139 failures happen before the generated fixture binary runs. The dominant problem is still the compiled `tcc-boot2` while it is compiling/linking C input, not the runtime behavior of most generated test binaries. +The previous run carved out a separate "`__builtin_va_start` warning, +then segfault" group (3 fixtures: 015-variadic, 076-vararg-recv, +079-vararg-deep). Those have moved into the `vtop[-1].r < VT_CONST` +cluster after the libp1pp consolidation in `cc.scm` (sub-word +ld/st, sext/zext, lea_slot, ptr arith, struct-copy via memcpy, +cmpset, neg/bnot/bool, switch_case): the cc.scm-built tcc-boot2 no +longer takes the upstream warning path, so the same underlying vstack +miscompile asserts directly. Failure counts shift slightly (58→59 +plain segfaults, 44→43 store-asserts, 28→31 vtop-asserts) for the +same reason — it's the same compiler bug surface, regrouped, not a +behavior regression. + Working hypothesis: our compiler is miscompiling tcc itself. In this suite, `tcc-boot2` is a tcc binary produced by `cc.scm`; the failures look like that produced tcc is executing bad compiler/codegen logic and @@ -224,9 +247,9 @@ Start with the earliest minimal failures in each dominant group: - `006-call-no-args`: first plain segfault with a very small source. - `001-kitchen-sink` or `012-struct-ptr`: first incorrect tcc parser diagnostics around aggregate initialization. -- `019-zext-narrow`, `068-main-noret`, `101-char-escapes`: the only - current failures where `tcc-boot2` successfully emits and links a - binary but the binary returns the wrong status. +- `019-zext-narrow`, `101-char-escapes`: the only current failures + where `tcc-boot2` successfully emits and links a binary but the + binary returns the wrong status. Keep using `make test SUITE=cc ARCH=aarch64 NAMES=...` as the control path for fixture semantics, and `make test SUITE=tcc-cc NAMES=...` as