fold-2 chunk C3 (drew's Fam8-13 plan): 8 alias value-row C drivers, 205 rows
re-homed with zero loss -- 177 value -> 8 test/lang/alias_*_test.ww @test
row-tables; 16 reject -> runww //ww:error carriers (both stages reject);
3 cs!=ww value rows -> 2 *_runonly_test.ww (T1, byte-id-excluded, #60/#81);
9 irreducible asymmetric rows -> slim C pins, each ticket-cited and
mutation-proven non-vacuous:
- accept amplen1/2,ampcap2: cs runs / ww rejects 'unsupported address-of
shape' (#96)
- cgen_b5 g73_heapfill: cs!=ww .s + ww link-fails on self-contained alloc;
compile-smoke pin (#24)
- cgen_b6 fsarg2_bound: both reject, different msgs, each vs the correct
stage (#271/#165 cs vs #272/#276/#277 ww)
- emit_b7 slc/slcstr/slctag _2lvl + slc_plain_ctl: slice-literal static-init
divergence (#120/#29-kin, ken-d2-oracle)
4 fully-migrated drivers deleted, 4 slimmed-in-place to hold only the
irreducible pins. LANGBYTEID floor 74->82 (8 new byte-id @test files); test
count 388->384 (4 deleted; 4 slimmed kept). do-not-auto-batch files not in
Fam10.
102 lines
3.0 KiB
C
102 lines
3.0 KiB
C
/*
|
|
* 944_alias_cgen_b5_run — SLIM CARRIER (#5-C3 alias fold-2). The 27 K_RUN value
|
|
* rows migrated to test/lang/alias_cgen_b5_test.ww (@test, cs==ww byte-id); the
|
|
* symmetric K_BUILDERR rejects (fill0_ctl, fill2_loud, g73_static_str) to
|
|
* test/wcc/data/alias_{fill0_ctl,fill2_loud,g73_static_str}/case.ww runww.
|
|
*
|
|
* What survives here is the one IRREDUCIBLE K_COMPILES row: both stages
|
|
* FRONTEND-compile (w6c / w6c_ww → .s, rc 0) but the asm diverges (the ww
|
|
* deref-field READ carries the #24 field(SB) leak) so run + byte-id cells are
|
|
* unavailable, and a full `ww build` can't link this self-contained `alloc()`
|
|
* case (no rt malloc) — runww //ww:compile links and so cannot host it. The
|
|
* pin is the ABSENCE of the pre-c2 cstage #73 fatal at the heap struct-lit
|
|
* str-arm fill; the ww-side leak rides task #24. Compile-smoke only.
|
|
*/
|
|
#include <stdio.h>
|
|
#include <stdlib.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;
|
|
}
|
|
|
|
/* both w6c and w6c_ww must FRONTEND-compile (rc 0); no run, no byte-id (#24). */
|
|
static int
|
|
run_row(const char *bin, const char *label, const char *src, int i)
|
|
{
|
|
char dir[96], srcf[160], ss[160], rm[200], cmd[2048];
|
|
snprintf(dir, sizeof dir, "/tmp/ab5_%d_%d", getpid(), i);
|
|
mkdir(dir, 0755);
|
|
snprintf(srcf, sizeof srcf, "%s/c.ww", dir);
|
|
snprintf(ss, sizeof ss, "%s/o.s", dir);
|
|
snprintf(rm, sizeof rm, "rm -rf %s", dir);
|
|
|
|
FILE *f = fopen(srcf, "wb");
|
|
if (!f) { runwait(rm); return -1; }
|
|
fputs(src, f);
|
|
fclose(f);
|
|
|
|
int ok = 1;
|
|
snprintf(cmd, sizeof cmd, "%s/w6c -o %s %s 2>/dev/null", bin, ss, srcf);
|
|
if (runwait(cmd) != 0) {
|
|
fprintf(stderr, "row[%s]: cstage frontend compile failed\n", label);
|
|
ok = 0;
|
|
}
|
|
snprintf(cmd, sizeof cmd, "%s/w6c_ww -o %s %s 2>/dev/null", bin, ss, srcf);
|
|
if (runwait(cmd) != 0) {
|
|
fprintf(stderr, "row[%s]: wwstage frontend compile failed\n", label);
|
|
ok = 0;
|
|
}
|
|
runwait(rm);
|
|
return ok ? 0 : 1;
|
|
}
|
|
|
|
struct row { const char *label; const char *src; };
|
|
|
|
static const struct row rows[] = {
|
|
{ "g73_heapfill",
|
|
"package main;\n"
|
|
"type s1t = str;\n"
|
|
"type s2t = s1t;\n"
|
|
"type box = struct { s: s2t, n: int };\n"
|
|
"export fn main() i32 = {\n"
|
|
" let p = alloc(box { s = \"hello\", n = 5 })!;\n"
|
|
" if (p.n != 5) { return 1; };\n"
|
|
" if (p.s.len != 5) { return 2; };\n"
|
|
" return 0;\n"
|
|
"};\n" },
|
|
};
|
|
|
|
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;
|
|
}
|
|
|
|
int n = (int)(sizeof rows / sizeof rows[0]);
|
|
int fail = 0;
|
|
for (int i = 0; i < n; i++)
|
|
if (run_row(bin, rows[i].label, rows[i].src, i) != 0) fail++;
|
|
|
|
if (fail) {
|
|
fprintf(stderr, "alias_cgen_b5 (slim): %d/%d rows failed\n", fail, n);
|
|
return 1;
|
|
}
|
|
printf("alias_cgen_b5 (slim): %d/%d ok\n", n, n);
|
|
return 0;
|
|
}
|