test: port 944_alias_cgen_b5_run to a compile fixture
944_alias_cgen_b5_run.c -> alias_g73_heapfill (//ww:compile), joining
its migrated alias_* siblings. The carrier's stated fixture blocker
('//ww:compile links') is stale: the COMPILE cell runs the bare
frontend, no link. The live #24 field(SB) deref-read leak enters
DATABYTEID_DIVERGED, upgrading the carrier's silent byte-id waiver
with a graduation tripwire.
This commit is contained in:
7
Makefile
7
Makefile
@@ -603,7 +603,12 @@ DATABYTEID_EXPECTED_MIN = 915
|
||||
# routes the cross-module tagged call-result through a 16B scratch pair
|
||||
# where cstage PUSHQes AX/DX (frame 16 vs 32); runtime-equivalent
|
||||
# (both stages run exit 42).
|
||||
DATABYTEID_DIVERGED = r700_strings_byteindex r839_xmod_nominal_match
|
||||
# alias_g73_heapfill: held divergence — the ww-side heap struct-lit
|
||||
# str-arm deref-field READ leaks a field(SB) load (task #24); both
|
||||
# stages frontend-compile rc 0, only the .s differs. Graduates out
|
||||
# when #24 lands.
|
||||
DATABYTEID_DIVERGED = r700_strings_byteindex r839_xmod_nominal_match \
|
||||
alias_g73_heapfill
|
||||
$(if $(DATABYTEID_FILES),,$(error test-byteid: empty data corpus))
|
||||
test-data-byteid: $(BIN)/ww $(BIN)/w6c $(BIN)/w6c_ww
|
||||
@work=$$(mktemp -d "$(CURDIR)/$(DATABYTEID_DIR).XXXXXX") || exit 1; \
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package wwfixture;
|
||||
|
||||
def protocolversion: i32 = 1;
|
||||
def corpuscount: i32 = 1679;
|
||||
def corpuscount: i32 = 1680;
|
||||
def errorcount: i32 = 343;
|
||||
def compilecount: i32 = 18;
|
||||
def compilecount: i32 = 19;
|
||||
def runcount: i32 = 209;
|
||||
def runexitcount: i32 = 1109;
|
||||
def nativecount: i32 = 3358;
|
||||
def corpushash: str = "0b3b997170a14de5d526e0d7ce7d5de3c1a33d85db7d029a26e6e01651857b5d";
|
||||
def nativecount: i32 = 3360;
|
||||
def corpushash: str = "bfc1df1f29f60a79930227b1b93ad01fcbed23a150c3269f1f6befd90e0604d1";
|
||||
|
||||
type directive = enum i32 {
|
||||
ERROR = 0,
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* 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 <errno.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[128], srcf[192], ss[192], cmd[2048];
|
||||
snprintf(dir, sizeof dir, "/tmp/ab5_%d_%d_XXXXXX", getpid(), i);
|
||||
if (mkdtemp(dir) == NULL) {
|
||||
fprintf(stderr, "row[%s]: temporary directory acquisition failed\n",
|
||||
label);
|
||||
return -1;
|
||||
}
|
||||
snprintf(srcf, sizeof srcf, "%s/c.ww", dir);
|
||||
snprintf(ss, sizeof ss, "%s/o.s", dir);
|
||||
|
||||
FILE *f = fopen(srcf, "wb");
|
||||
int ok = 1;
|
||||
if (!f) {
|
||||
fprintf(stderr, "row[%s]: source setup failed\n", label);
|
||||
ok = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
fputs(src, f);
|
||||
fclose(f);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
{
|
||||
int bad = 0;
|
||||
if (unlink(ss) != 0 && errno != ENOENT) bad = 1;
|
||||
if (unlink(srcf) != 0 && errno != ENOENT) bad = 1;
|
||||
if (rmdir(dir) != 0) bad = 1;
|
||||
if (bad) {
|
||||
fprintf(stderr, "row[%s]: temporary cleanup failed\n", label);
|
||||
ok = 0;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
12
test/wcc/data/alias_g73_heapfill/case.ww
Normal file
12
test/wcc/data/alias_g73_heapfill/case.ww
Normal file
@@ -0,0 +1,12 @@
|
||||
//ww:compile
|
||||
// migrated from test/wcc/944_alias_cgen_b5_run.c: heap struct-lit str-arm fill through a 2-level str alias — pins the absence of the pre-c2 cstage #73 fatal; ww .s carries the #24 field(SB) deref-read leak (DATABYTEID_DIVERGED).
|
||||
package main;
|
||||
type s1t = str;
|
||||
type s2t = s1t;
|
||||
type box = struct { s: s2t, n: int };
|
||||
export fn main() i32 = {
|
||||
let p = alloc(box { s = "hello", n = 5 })!;
|
||||
if (p.n != 5) { return 1; };
|
||||
if (p.s.len != 5) { return 2; };
|
||||
return 0;
|
||||
};
|
||||
Reference in New Issue
Block a user