wwstage: name vararg-gather slots via mklabel; graduate fmt 777/780/781 (#227)

wwstage named variadic-gather slots with mkvarargname off a separate
varargseq counter, never bumping the shared labelseq that names match
labels. cstage names them via mklabel (cmd/w6c/cgen.c:5427,5431), which
advances labelseq twice per gather. So by the time main.main reached its
`match (wr)`, wwstage's match-label counter ran two behind cstage's
(_4/_5/_6 vs _6/_7/_8) — a pure label-numbering divergence that kept fmt
cs/ww byte-id failing.

Drop varargseq and the mkvarargname helper; call the existing mklabel
for the two gather slots, matching cstage's order (vararg_d only when
nvar>0, vararg_sl always). The slot names are locals-table keys only —
they resolve to BP offsets and never reach the asm — so only the
labelseq advance is observable, which is exactly what realigns the
downstream match labels. cstage untouched (align wwstage up).

This was the match-label half of fmt's divergence; with the earlier
compound-assign fix it completes fmt byte-identity. Graduate
777/780/781 to STAGE_CS|STAGE_WW with byte_id, and drop the now-stale
(void)asm_byte_identical guard in 777.
This commit is contained in:
2026-06-01 05:04:46 +09:00
parent 9cf1560392
commit 954badd28f
8 changed files with 58 additions and 152 deletions

View File

@@ -117,7 +117,7 @@ static const struct row rows[] = {
" return 42;\n"
"};\n",
42,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
{ "fprintln_file_multi",
"package main;\n"
"import os;\n"
@@ -145,7 +145,7 @@ static const struct row rows[] = {
" return 43;\n"
"};\n",
43,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
{ "fprint_file_raw",
"package main;\n"
"import os;\n"
@@ -173,7 +173,7 @@ static const struct row rows[] = {
" return 44;\n"
"};\n",
44,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
{ "branched_fprintf",
"package main;\n"
"import os;\n"
@@ -206,7 +206,7 @@ static const struct row rows[] = {
" return 45;\n"
"};\n",
45,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
{ "fprintf_stream",
"package main;\n"
"import os;\n"
@@ -230,7 +230,7 @@ static const struct row rows[] = {
" return 46;\n"
"};\n",
46,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
};
static int
@@ -357,7 +357,6 @@ main(void)
int total = 0, fail = 0;
int wwpresent = (access(wdrv, X_OK) == 0);
int seq = 0;
(void)asm_byte_identical; /* cstage-only until #226/#227 land */
for (int i = 0; i < n; i++) {
if (rows[i].stage_mask & STAGE_CS) {