Files
ww/test/wcc/944_alias_cgen_b6_run.c
Hojun-Cho c136f3c0f7 cgen: B6-c4 cast/is/try family single peels fold into type_chase_named — 10 lines
The exact B6-c4 set (rob b6 spec §2, numbering at 4cac1cb): :9422
(N_MATCH Family-C identity-cast peel su), :9598 (match-bind base bu),
:9674 (tryprop non-call source u), :9718 (cg_ret_type peel r at the
cgexpr try region — same rt-route kinship as B5-c3's cgreturn chase:
the nullable/tagged propagate keys the chased enclosing return type
exactly as the return arms do), :9819 (tryunw twin u — LOUD-PRESERVING
ONLY, the #38b sret bound is alias-INDEPENDENT), :9986/:9991
(N_TYPEASSERT u + enum vu), :10103/:10105 (str→[]u8 cap-synth tu/fu),
:10131 (narrowing-cast tu). Raw `->under` in cgen.c 27→17 — remaining
= whitelist 5 (:731 :813/:814 :834/:835) + B7 emitters 4 + the c5
set 8, grep-verified exact.

FLIP: kb6_strcast (str→[]u8 over 2-level alias, was both-correct
divergent NO(2)) → 0/0 BYTE-ID; cs converged onto ww's UNCHANGED asm
(#263 polarity, cmp-proven) and the alias shape now equals the plain
shape (kb6_strcast_p, same hash — ken's c4 pre-test confirmed ww's
dedicated gate DOES fire on alias here, unlike the c3 sites).
kb6_try loud held both stages with the pinned #38b text (try_loud_38b
row); idcast/is/succ byte-id held; zero other movers.

TRAIN INVARIANT: cs-only; w6c_ww/ww_ww bit-identical to the 4cac1cb
baselines (b6bddc8e…/4e9ca874…). cs movers c3→c4 bounded to exactly
{kb6_strcast}; rest of corpus + five mains byte-NEUTRAL; detectors
unmoved; 989 ratchet zero flips.

944_alias_cgen_b6_run grows 14→18 rows, 38→49 checks: strcast_2lvl
flip + idcast_2lvl/is_2lvl controls + try_loud_38b both-loud pin.
All 944-family suites green; sizelint 0.
2026-06-06 04:28:23 +09:00

558 lines
20 KiB
C

/*
* 944_alias_cgen_b6_run — #5 alias arc F2b (B6 train): the cgen.c
* cgexpr/cgstmt INLINE single-peel sweep through type_chase_named, by
* consumer family — c1 assign/reassign (9 lines), c2 call-arg (8),
* c3 addr-of/field-walk/index spine (14), c4 cast/is/try (10),
* c5 reads/len/globals (8). All cs-only: every graduation is a
* DIVERGE→byte-id flip (cs aligns UP to ww's already-chasing asm);
* zero selfhost/lib bytes move across the train, so the _ww binaries
* stay bit-identical (the crossing detector).
*
* Row sources are ken's B6 first-position oracle probes
* (/tmp/ken_b5/src/kb6_*, .ai/ken-b6-oracle.md, matrix at 4cac1cb).
*
* row | shape (oracle row) | cs/ww
* --------------------+-------------------------------------+------
* ---- c1 (assign/reassign: :6359 :6403/:6405 :6460/:6462 -------
* :6518 + cgstmt :11696 :12047 :13625) -------------------
* streassign_2lvl | kb6_streassign: 2-lvl alias str |
* | reassign `b = a` — cs copied WORD0 |
* | (ptr) ONLY, len/cap stale (silent |
* | exit 1); the :6518 lu gate fell to |
* | the scalar default. LIVE graduation | 0/0
* wstore_a (B5 file) | kb5_wstore_a graduates K_RUN_NOID → |
* | K_RUN in 944_alias_cgen_b5_run.c — |
* | the ident-lhs N_ASSIGN tagged gate |
* | (:6359) was the divergence (ken |
* | C1-CORR-2, he owns the flip) | 0/0
* sreassign_2lvl | kb6_sreassign: whole-struct alias |
* | reassign — latent control | 0/0
* dassign_2lvl | kb6_dassign: (*p).f= over alias ptr |
* | — latent control | 0/0
* ---- c2 (call-arg: :8402 :8435 :8561/:8563/:8577/:8579 --------
* + LOUD-PRESERVING :8829 :8934) ------------------------
* fsarg0_loud_ctl | kb6_fsarg0: PLAIN float-struct from |
* | a non-ident source — #271/#165 loud |
* | BOTH stages (control, twin texts) | err/err
* fsarg2_bound | kb6_fsarg2: 1-alias-level respell — |
* | pre-c2 the :8829 single-peel let |
* | the alias DODGE the fatal; cs GP- |
* | passed by self-consistent luck. |
* | DESIGNED NARROWING: cs now louds |
* | with the pinned #271/#165 text |
* | ("widen what the gate SEES, never |
* | what it ACCEPTS"). ww's loud is its |
* | own alias-return bound (#272/#277 |
* | class, experr_ww) — per-stage texts | err/err
* fsarg_ident_ctl | kb6_fsarg: IDENT-source alias twin |
* | — ident domain out of the :8829 |
* | gate, latent control | 0/0
* sarg_2lvl | kb6_sarg: >16B alias struct arg — |
* | latent (B5 helper chases carry the |
* | type layer) | 0/0
* strarg_2lvl | kb6_strarg: alias str arg — latent | 0/0
* (:8934 tuple loud is WATCH-ONLY: alias spellings are |
* checker-blocked upstream (#86/#99) — the pin is the b5 |
* suite's tuparg_cast_bound99 two-key cells, which must |
* not move.) |
* ---- c3 (addr-of/field-walk/index spine: :3949 :4006 ---------
* :4124/:4128 :5029/:5035/:5052 :5937 :10953/:10956 -----
* :11046/:11052/:11067 :11285, numbering at 4cac1cb) ----
* idxf_2lvl / | kb6_idxf (indexed-elem struct field |
* ampf_2lvl | write+read) / kb6_ampf (&p.b over |
* | alias ptr): the c3 chase moved cs |
* | onto the PLAIN-canonical dedicated |
* | shape (cs_alias == ww_PLAIN, bit- |
* | proven, ken c3-STOP addendum) — but |
* | WWSTAGE is the alias-blind side at |
* | these two sites (ww_alias != |
* | ww_plain, generic-but-correct |
* | routes). Two-cell NOID pins; byte-id |
* | graduates with the filed ww-side W2 |
* | fold, task #102 (ww indexed-elem |
* | field gates + &p.f fallback don't |
* | fire on alias bases). ampf's pre-c3 |
* | byte-id was both-on-generic |
* | identity, not latency (oracle |
* | self-correction) | 0/0
* idxf_plain_ctl / | plain no-alias twins — pin the |
* ampf_plain_ctl | canonical dedicated shape byte-id |
* | BOTH stages (the convergence target |
* | the NOID rows graduate onto) | 0/0
* chdot_2lvl | kb6_chdot: chained dot over alias |
* | hops — latent control | 0/0
* esub_2lvl | kb6_esub: [3]my32b narrow-elem index |
* | (#61/#101-kin at the INDEX sites) — |
* | latent control | 0/0
* ---- c4 (cast/is/try: :9422 :9598 :9674 :9718 :9819 ----------
* :9986/:9991 :10103/:10105 :10131, numbering at 4cac1cb) -
* strcast_2lvl | kb6_strcast: str→[]u8 over 2-lvl |
* | alias — was both-correct divergent; |
* | the :10103/:10105 tu/fu chase FLIPS |
* | it (cs → ww's unchanged asm, #263 |
* | polarity; alias == plain shape) | 0/0
* idcast_2lvl | kb6_idcast: identity cast over alias |
* | union (Family-C peel) — latent | 0/0
* is_2lvl | kb6_is: `is` over alias union — |
* | latent control | 0/0
* try_loud_38b | kb6_try: `?` on a >48B sret-class |
* | call result — the #38b loud is |
* | ALIAS-INDEPENDENT (documented bound);|
* | :9819's chase is loud-preserving |
* | ONLY — twin texts, shared experr | err/err
*
* K_RUN rows build+run BOTH drivers (cs exit==cswant, ww exit==wwwant)
* and assert cstage/wwstage asm byte-id. K_BUILDERR rows must FAIL
* with experr on BOTH drivers; experr_ww overrides the ww-side text
* when the two stages loud at DIFFERENT sites (per-stage texts).
* NNN<950, self-contained /tmp sources, no imports (944 precedent).
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/wait.h>
static int
runwait(const char *cmd)
{
int rc = system(cmd);
if (rc == -1) return -1;
if (WIFEXITED(rc)) return WEXITSTATUS(rc);
return -1;
}
static int
slurp_eq(const char *a, const char *b)
{
FILE *fa = fopen(a, "rb");
FILE *fb = fopen(b, "rb");
if (!fa || !fb) { if (fa) fclose(fa); if (fb) fclose(fb); return -1; }
int rc = 0;
for (;;) {
int ca = fgetc(fa), cb = fgetc(fb);
if (ca != cb) { rc = -1; break; }
if (ca == EOF) break;
}
fclose(fa); fclose(fb);
return rc;
}
#define K_RUN 0 /* build+run BOTH, exits==wants, + byte-id */
#define K_BUILDERR 1 /* build FAILS with experr on BOTH drivers;
* experr_ww overrides the ww-side text */
#define K_RUN_NOID 2 /* build+run BOTH, exits==wants, byte-id
* SKIPPED — cite the blocking task */
struct row { const char *label; const char *src;
int cswant; int wwwant; int kind;
const char *experr; const char *experr_ww; };
/* errlog_has — a builderr cell must fail WITH its diagnostic; any other
* failure (parse error, crash, hang-kill) is a vacuous reject (940
* precedent). */
static int
errlog_has(const char *path, const char *needle)
{
FILE *f = fopen(path, "rb");
if (!f) return 0;
char buf[8192];
size_t got = fread(buf, 1, sizeof buf - 1, f);
fclose(f);
buf[got] = '\0';
return strstr(buf, needle) != NULL;
}
static const struct row rows[] = {
/* ---- c1: assign/reassign family */
/* LIVE c1 graduation: the :6518 reassign gate single-peeled the
* 2-level alias str lhs, missed the TY_STR kind test, and fell
* to the scalar default — ONE MOVQ stored the ptr word, len/cap
* kept the dead value's header (cs silent exit 1, ww correct:
* full 3-word {ptr,len,cap} store, Hare value semantics). */
{ "streassign_2lvl",
"package main;\n"
"type ms0 = str;\n"
"type ms = ms0;\n"
"export fn main() i32 = {\n"
" let a: ms = \"hello\";\n"
" let b: ms = \"x\";\n"
" b = a;\n"
" if (len(b) != 5) { return 1; };\n"
" return 0;\n"
"};\n", 0, 0, K_RUN, NULL, NULL },
{ "sreassign_2lvl",
"package main;\n"
"type st0 = struct { a: i64, b: i64, c: i64 };\n"
"type st = st0;\n"
"export fn main() i32 = {\n"
" let x: st; x.a = 1; x.b = 2; x.c = 3;\n"
" let y: st; y.a = 0; y.b = 0; y.c = 0;\n"
" y = x;\n"
" if (y.c != 3 || y.b != 2) { return 1; };\n"
" return 0;\n"
"};\n", 0, 0, K_RUN, NULL, NULL },
{ "dassign_2lvl",
"package main;\n"
"type st0 = struct { a: i64, b: i64 };\n"
"type st = st0;\n"
"export fn main() i32 = {\n"
" let x: st; x.a = 1; x.b = 2;\n"
" let p: *st = &x;\n"
" (*p).b = 9;\n"
" if (x.b != 9) { return 1; };\n"
" return 0;\n"
"};\n", 0, 0, K_RUN, NULL, NULL },
/* ---- c2: call-arg family */
{ "fsarg0_loud_ctl",
"package main;\n"
"type fs0 = struct { x: f64 };\n"
"fn mk() fs0 = {\n"
" let s: fs0; s.x = 2.5;\n"
" return s;\n"
"};\n"
"fn g(p: fs0) f64 = { return p.x; };\n"
"export fn main() i32 = {\n"
" if (g(mk()) != 2.5) { return 1; };\n"
" return 0;\n"
"};\n", 0, 0, K_BUILDERR,
"#271/#165: float-bearing struct arg from a non-ident source",
NULL },
/* DESIGNED ACCEPTANCE NARROWING (B6-c2): pre-c2 cs accepted and
* GP-passed this float struct correct-by-self-consistent-luck
* (caller+callee agreed on the wrong transport) — the :8829
* single peel let a 1-level alias dodge the rule-7 fatal. The
* chase widens what the gate SEES; the loud stays loud for the
* shapes it guards. ww's cell was ALREADY loud at its own
* alias-return bound (#272/#276/#277 class) — different site,
* per-stage experr. */
{ "fsarg2_bound",
"package main;\n"
"type fs0 = struct { x: f64 };\n"
"type fs = fs0;\n"
"fn mk() fs = {\n"
" let s: fs; s.x = 2.5;\n"
" return s;\n"
"};\n"
"fn g(p: fs) f64 = { return p.x; };\n"
"export fn main() i32 = {\n"
" if (g(mk()) != 2.5) { return 1; };\n"
" return 0;\n"
"};\n", 0, 0, K_BUILDERR,
"#271/#165: float-bearing struct arg from a non-ident source",
"#272/#276/#277: aggregate return reaches scalar default" },
{ "fsarg_ident_ctl",
"package main;\n"
"type fs0 = struct { x: f64 };\n"
"type fs = fs0;\n"
"fn mk() fs0 = {\n"
" let s: fs0; s.x = 2.5;\n"
" return s;\n"
"};\n"
"fn g(p: fs) f64 = { return p.x; };\n"
"export fn main() i32 = {\n"
" let v: fs = mk();\n"
" if (g(v) != 2.5) { return 1; };\n"
" return 0;\n"
"};\n", 0, 0, K_RUN, NULL, NULL },
{ "sarg_2lvl",
"package main;\n"
"type big0 = struct { a: i64, b: i64, c: i64 };\n"
"type big = big0;\n"
"fn g(p: big) i64 = { return p.a + p.c; };\n"
"export fn main() i32 = {\n"
" let s: big; s.a = 4; s.b = 5; s.c = 9;\n"
" if (g(s) != 13) { return 1; };\n"
" return 0;\n"
"};\n", 0, 0, K_RUN, NULL, NULL },
{ "strarg_2lvl",
"package main;\n"
"type ms0 = str;\n"
"type ms = ms0;\n"
"fn g(s: ms) i64 = { return len(s): i64; };\n"
"export fn main() i32 = {\n"
" let a: ms = \"hello\";\n"
" if (g(a) != 5) { return 1; };\n"
" return 0;\n"
"};\n", 0, 0, K_RUN, NULL, NULL },
/* ---- c3: addr-of/field-walk/index spine */
/* The c3 chase put cs on the PLAIN-canonical dedicated shape
* (cs_alias == ww_PLAIN, bit-proven — ken c3-STOP addendum);
* WWSTAGE is the alias-blind side here: its indexed-elem
* struct-field store/read gates don't fire on alias bases and
* fall to a generic-but-correct route. Byte-id waived until the
* filed ww-side W2 fold (task #102) lands; idxf_plain_ctl pins the
* convergence target. */
{ "idxf_2lvl",
"package main;\n"
"type el0 = struct { a: i64, b: i64 };\n"
"type el = el0;\n"
"export fn main() i32 = {\n"
" let xs: [2]el;\n"
" xs[0].a = 1; xs[0].b = 2;\n"
" xs[1].a = 3; xs[1].b = 4;\n"
" if (xs[1].b != 4 || xs[0].b != 2) { return 1; };\n"
" return 0;\n"
"};\n", 0, 0, K_RUN_NOID, NULL, NULL }, /* byte-id: task #102 */
{ "idxf_plain_ctl",
"package main;\n"
"type el0 = struct { a: i64, b: i64 };\n"
"export fn main() i32 = {\n"
" let xs: [2]el0;\n"
" xs[0].a = 1; xs[0].b = 2;\n"
" xs[1].a = 3; xs[1].b = 4;\n"
" if (xs[1].b != 4 || xs[0].b != 2) { return 1; };\n"
" return 0;\n"
"};\n", 0, 0, K_RUN, NULL, NULL },
/* &p.b ptr-field fallback twin of the same re-attribution: the
* pre-c3 byte-id here was BOTH stages on the generic spine
* (gate-blind identity, not M5 latency — oracle self-correction
* banked in ken's c3-STOP addendum). */
{ "ampf_2lvl",
"package main;\n"
"type st0 = struct { a: i64, b: i64 };\n"
"type st = st0;\n"
"export fn main() i32 = {\n"
" let x: st; x.a = 1; x.b = 2;\n"
" let p: *st = &x;\n"
" let q: *i64 = &p.b;\n"
" *q = 9;\n"
" if (x.b != 9) { return 1; };\n"
" return 0;\n"
"};\n", 0, 0, K_RUN_NOID, NULL, NULL }, /* byte-id: task #102 */
{ "ampf_plain_ctl",
"package main;\n"
"type st0 = struct { a: i64, b: i64 };\n"
"export fn main() i32 = {\n"
" let x: st0; x.a = 1; x.b = 2;\n"
" let p: *st0 = &x;\n"
" let q: *i64 = &p.b;\n"
" *q = 9;\n"
" if (x.b != 9) { return 1; };\n"
" return 0;\n"
"};\n", 0, 0, K_RUN, NULL, NULL },
{ "chdot_2lvl",
"package main;\n"
"type in0 = struct { v: i64 };\n"
"type in1 = in0;\n"
"type out0 = struct { inner: in1, n: i64 };\n"
"type out1 = out0;\n"
"export fn main() i32 = {\n"
" let s: out1; s.inner.v = 7; s.n = 3;\n"
" let p: *out1 = &s;\n"
" if (p.inner.v != 7) { return 1; };\n"
" return 0;\n"
"};\n", 0, 0, K_RUN, NULL, NULL },
{ "esub_2lvl",
"package main;\n"
"type my32 = u32;\n"
"type my32b = my32;\n"
"export fn main() i32 = {\n"
" let xs: [3]my32b;\n"
" xs[0] = 5; xs[1] = 6; xs[2] = 7;\n"
" if (xs[0]: i64 + xs[1]: i64 + xs[2]: i64 != 18) { return 1; };\n"
" return 0;\n"
"};\n", 0, 0, K_RUN, NULL, NULL },
/* ---- c4: cast/is/try family */
{ "strcast_2lvl",
"package main;\n"
"type ms0 = str;\n"
"type ms = ms0;\n"
"export fn main() i32 = {\n"
" let a: ms = \"hey\";\n"
" let b: []u8 = a: []u8;\n"
" if (len(b) != 3) { return 1; };\n"
" if (b[0] != 'h') { return 2; };\n"
" return 0;\n"
"};\n", 0, 0, K_RUN, NULL, NULL },
{ "idcast_2lvl",
"package main;\n"
"type u0 = (void | i64);\n"
"type u = u0;\n"
"export fn main() i32 = {\n"
" let v: u = 42i64;\n"
" let w: u = (v: u);\n"
" match (w) {\n"
" case let n: i64 => { if (n != 42) { return 1; }; };\n"
" case void => { return 2; };\n"
" };\n"
" return 0;\n"
"};\n", 0, 0, K_RUN, NULL, NULL },
{ "is_2lvl",
"package main;\n"
"type u0 = (void | i64);\n"
"type u = u0;\n"
"export fn main() i32 = {\n"
" let v: u = 42i64;\n"
" if (!(v is i64)) { return 1; };\n"
" if (v is void) { return 2; };\n"
" return 0;\n"
"};\n", 0, 0, K_RUN, NULL, NULL },
/* ALIAS-INDEPENDENT #38b bound (ken's row is >48B sret-class):
* the :9819 chase must stay loud-preserving — this pins the
* fatal so a future chase can't silently green it. */
{ "try_loud_38b",
"package main;\n"
"type e0 = !i64;\n"
"type big = struct { a: i64, b: i64, c: i64, d: i64, e: i64, f: i64, g: i64 };\n"
"type r0 = (big | e0);\n"
"type r = r0;\n"
"fn w() r = {\n"
" let s: big;\n"
" s.a = 1; s.b = 2; s.c = 3; s.d = 4; s.e = 5; s.f = 6; s.g = 77;\n"
" return s;\n"
"};\n"
"fn outer() (i64 | e0) = {\n"
" let v = w()?;\n"
" return v.g;\n"
"};\n"
"export fn main() i32 = {\n"
" match (outer()) {\n"
" case let n: i64 => { if (n != 77) { return 1; }; };\n"
" case e0 => { return 2; };\n"
" };\n"
" return 0;\n"
"};\n", 0, 0, K_BUILDERR,
"#38b: `?`/`!` on an sret-class call result unwired", NULL },
};
static int
run_driver(const char *driver, const struct row *r, int i, int expect_err,
int want, const char *experr)
{
char src[96], tmpdir[96], errf[96], cmd[1024];
snprintf(src, sizeof src, "/tmp/ab6_%d_%d.ww", getpid(), i);
snprintf(tmpdir, sizeof tmpdir, "/tmp/ab6_%d_d_%d", getpid(), i);
snprintf(errf, sizeof errf, "/tmp/ab6_%d_e_%d", getpid(), i);
FILE *f = fopen(src, "wb");
if (!f) return -1;
fputs(r->src, f);
fclose(f);
mkdir(tmpdir, 0755);
snprintf(cmd, sizeof cmd,
"cd %s && timeout 20 %s build %s >/dev/null 2>%s",
tmpdir, driver, src, errf);
int brc = runwait(cmd);
if (expect_err) {
int ok = (brc != 0)
&& (experr == NULL || errlog_has(errf, experr));
if (!ok)
fprintf(stderr, "row[%s]: %s expected loud builderr "
"\"%s\" (brc=%d)\n", r->label, driver,
experr ? experr : "", brc);
unlink(src); unlink(errf); rmdir(tmpdir);
return ok ? 0 : 1;
}
if (brc != 0) {
fprintf(stderr, "row[%s]: build via %s failed\n",
r->label, driver);
unlink(src); unlink(errf); rmdir(tmpdir);
return -1;
}
const char *base = strrchr(src, '/');
base = base ? base + 1 : src;
char outbin[256];
snprintf(outbin, sizeof outbin, "%s/%s", tmpdir, base);
char *dot = strrchr(outbin, '.');
if (dot && strcmp(dot, ".ww") == 0) *dot = '\0';
int got = runwait(outbin);
unlink(src); unlink(outbin); unlink(errf); rmdir(tmpdir);
if (got != want) {
fprintf(stderr, "row[%s]: %s exit %d, want %d\n",
r->label, driver, got, want);
return 1;
}
return 0;
}
static int
asm_byte_identical(const char *bin, const struct row *r, int i)
{
char src[96], cs[96], ws[96], cmd[1024];
snprintf(src, sizeof src, "/tmp/ab6_asm_%d_%d.ww", getpid(), i);
snprintf(cs, sizeof cs, "/tmp/ab6_asm_%d_%d_c.s", getpid(), i);
snprintf(ws, sizeof ws, "/tmp/ab6_asm_%d_%d_w.s", getpid(), i);
FILE *f = fopen(src, "wb");
if (!f) return -1;
fputs(r->src, f);
fclose(f);
snprintf(cmd, sizeof cmd, "%s/w6c -o %s %s 2>/dev/null", bin, cs, src);
if (runwait(cmd) != 0) {
fprintf(stderr, "row[%s]: w6c errored\n", r->label);
unlink(src);
return -1;
}
snprintf(cmd, sizeof cmd, "%s/w6c_ww -o %s %s 2>/dev/null",
bin, ws, src);
if (runwait(cmd) != 0) {
fprintf(stderr, "row[%s]: w6c_ww errored\n", r->label);
unlink(src); unlink(cs);
return -1;
}
int rc = slurp_eq(cs, ws);
if (rc != 0)
fprintf(stderr, "row[%s]: cstage vs wwstage asm differs\n",
r->label);
unlink(src); unlink(cs); unlink(ws);
return rc;
}
int
main(void)
{
const char *bin = getenv("BIN");
if (!bin) bin = "out/bin";
char absbin[2080];
if (bin[0] != '/') {
char cwd[1024];
if (getcwd(cwd, sizeof cwd) == NULL) return 1;
snprintf(absbin, sizeof absbin, "%s/%s", cwd, bin);
bin = absbin;
}
char cdrv[2120], wdrv[2120];
snprintf(cdrv, sizeof cdrv, "%s/ww", bin);
snprintf(wdrv, sizeof wdrv, "%s/ww_ww", bin);
int n = (int)(sizeof rows / sizeof rows[0]);
int total = 0, fail = 0;
for (int i = 0; i < n; i++) {
total++;
int cs_err = rows[i].kind == K_BUILDERR;
if (run_driver(cdrv, &rows[i], i, cs_err,
rows[i].cswant, rows[i].experr) != 0) fail++;
}
if (access(wdrv, X_OK) == 0) {
for (int i = 0; i < n; i++) {
total++;
int ww_err = rows[i].kind == K_BUILDERR;
const char *we = rows[i].experr_ww
? rows[i].experr_ww : rows[i].experr;
if (run_driver(wdrv, &rows[i], i, ww_err,
rows[i].wwwant, we) != 0) fail++;
}
for (int i = 0; i < n; i++) {
if (rows[i].kind != K_RUN)
continue;
total++;
if (asm_byte_identical(bin, &rows[i], i) != 0) fail++;
}
}
if (fail) {
fprintf(stderr, "alias_cgen_b6: %d/%d checks failed\n",
fail, total);
return 1;
}
printf("alias_cgen_b6: %d/%d ok\n", total, total);
return 0;
}