/* * 989_strglobeq_run — #154 regression pin. Compile + run the strglobeq * fixture under the C-side `ww run` driver (cstage w6c) and assert exit 0. * * The bug (str== fast-path read the global str header off BP+0 instead of * name(SB)) is a CSTAGE silent miscompile; byte-id 990-997 can't see a * runtime-value miscompile, so only this value check catches it. Same * thin-wrapper shape as 989_letshadow_run. */ #include #include #include #include static int runwait(const char *cmd) { int rc = system(cmd); if (rc == -1) return -1; if (WIFEXITED(rc)) return WEXITSTATUS(rc); return 1; } int main(void) { const char *bin = getenv("BIN"); if (!bin) bin = "out/bin"; char absbin[1024]; 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 cwd[1024]; if (getcwd(cwd, sizeof cwd) == NULL) return 1; const char *src = "test/wcc/989_strglobeq.ww"; char path[1024], cmd[2048]; snprintf(path, sizeof path, "%s/%s", cwd, src); snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path); int rc = runwait(cmd); if (rc != 0) { fprintf(stderr, "strglobeq_run FAIL: %s exited %d " "(row %d miscompiled — #154)\n", src, rc, rc - 10); return 1; } printf("strglobeq_run: %s ok\n", src); return 0; }