wcc_ww/cgen: #82 cgun &base[i] classify off the chased stamped base type
The TK_AMP N_INDEX arm keyed arrayness off the SYNTACTIC tnode (local leg isarr at the baselocal read; global leg isglobalarr/isglobalptr at the letvartnode read) — an alias-typed base (tnode N_TNAME) missed the N_TARRAY gate, so the base materialized as MOVQ (element-0 VALUE) instead of LEAQ (storage address): wild pointer, SEGV/corruption on the deref. SILENT class (metric-1). The global leg graduated from latent to live when g-fold #77/#78 landed alias-global DATA emit. Fix re-keys both legs off tichase(base.type_) gated on TY_NAMED — the landed cgindex #60 idiom (cgenexpr.ww:1800-1820). cstage already classifies off the chased type (type_chase_named, cmd/w6c/cgen.c: 4172-4188) and is the runtime-correct reference: align ww UP. esz does NOT move — elemsizeofc chases internally since batch-2 (PREMISE-2 probe-confirmed via amp_narrow: stride right, base wrong pre-fix). Non-alias rows byte-id-neutral by construction (TY_NAMED gate). Pin: 944_alias_amp_idx_run, 8 rows through the taken pointer (plain local/global+str controls hold 0/0; 1/2-level alias local + global, fwd-ref decl order, narrow [4]u32 graduate cs0/wwSEGV-byte-id-NO -> 0/0 byte-id). Probed OUT, filed not fixed (spec §1 NOTE-2): &D[i] def-array base breaks at a DIFFERENT site both stages (cs XORQ BX,BX zero-base cgen.c:4209-4212, ww complex-base fallback; both SEGV 139). Light gates: test-unit 289 green; sizelint 0; 989 ratchet zero flips (31 ID / 9 DIVERGE / 3 WWREJECT pins hold); five-mains NEUTRAL vs master-74195ac scratch build on identical inputs + cs==ww on all five. combined.ww regens ride along (#110).
This commit is contained in:
@@ -25639,6 +25639,32 @@ fn cgun(c: *cgen, n: *node) void = {
|
||||
};
|
||||
};
|
||||
};
|
||||
// #82: the tnode-kind classify above misses an
|
||||
// alias-typed base (N_TNAME) — base materialized
|
||||
// as MOVQ (element-0 VALUE) instead of LEAQ, a
|
||||
// wild pointer. Re-key arrayness off the chased
|
||||
// checker-stamped base type, the cgindex #60
|
||||
// idiom (cgenexpr.ww:1800-1820); cstage already
|
||||
// classifies off type_chase_named uniformly
|
||||
// (cmd/w6c/cgen.c:4172-4188). TY_NAMED gate
|
||||
// keeps non-alias rows byte-id by construction.
|
||||
let bt82: *tinfo = base.type_: *tinfo;
|
||||
let basealias82: bool = false;
|
||||
if (bt82 != nil) {
|
||||
if (bt82.kind == tykind.TY_NAMED) { basealias82 = true; };
|
||||
};
|
||||
if (basealias82) {
|
||||
let bu82: *tinfo = tichase(bt82);
|
||||
if (bu82 != nil) {
|
||||
if (baselocal != nil) {
|
||||
isarr = bu82.kind == tykind.TY_ARRAY;
|
||||
};
|
||||
if (isglobalarr || isglobalptr) {
|
||||
isglobalarr = bu82.kind == tykind.TY_ARRAY;
|
||||
isglobalptr = !isglobalarr;
|
||||
};
|
||||
};
|
||||
};
|
||||
} else { if (base.kind == nkind.N_DOT
|
||||
|| (base.kind == nkind.N_UN
|
||||
&& base.op == tkind.TK_STAR)) {
|
||||
|
||||
@@ -4664,6 +4664,32 @@ fn cgun(c: *cgen, n: *node) void = {
|
||||
};
|
||||
};
|
||||
};
|
||||
// #82: the tnode-kind classify above misses an
|
||||
// alias-typed base (N_TNAME) — base materialized
|
||||
// as MOVQ (element-0 VALUE) instead of LEAQ, a
|
||||
// wild pointer. Re-key arrayness off the chased
|
||||
// checker-stamped base type, the cgindex #60
|
||||
// idiom (cgenexpr.ww:1800-1820); cstage already
|
||||
// classifies off type_chase_named uniformly
|
||||
// (cmd/w6c/cgen.c:4172-4188). TY_NAMED gate
|
||||
// keeps non-alias rows byte-id by construction.
|
||||
let bt82: *tinfo = base.type_: *tinfo;
|
||||
let basealias82: bool = false;
|
||||
if (bt82 != nil) {
|
||||
if (bt82.kind == tykind.TY_NAMED) { basealias82 = true; };
|
||||
};
|
||||
if (basealias82) {
|
||||
let bu82: *tinfo = tichase(bt82);
|
||||
if (bu82 != nil) {
|
||||
if (baselocal != nil) {
|
||||
isarr = bu82.kind == tykind.TY_ARRAY;
|
||||
};
|
||||
if (isglobalarr || isglobalptr) {
|
||||
isglobalarr = bu82.kind == tykind.TY_ARRAY;
|
||||
isglobalptr = !isglobalarr;
|
||||
};
|
||||
};
|
||||
};
|
||||
} else { if (base.kind == nkind.N_DOT
|
||||
|| (base.kind == nkind.N_UN
|
||||
&& base.op == tkind.TK_STAR)) {
|
||||
|
||||
@@ -25639,6 +25639,32 @@ fn cgun(c: *cgen, n: *node) void = {
|
||||
};
|
||||
};
|
||||
};
|
||||
// #82: the tnode-kind classify above misses an
|
||||
// alias-typed base (N_TNAME) — base materialized
|
||||
// as MOVQ (element-0 VALUE) instead of LEAQ, a
|
||||
// wild pointer. Re-key arrayness off the chased
|
||||
// checker-stamped base type, the cgindex #60
|
||||
// idiom (cgenexpr.ww:1800-1820); cstage already
|
||||
// classifies off type_chase_named uniformly
|
||||
// (cmd/w6c/cgen.c:4172-4188). TY_NAMED gate
|
||||
// keeps non-alias rows byte-id by construction.
|
||||
let bt82: *tinfo = base.type_: *tinfo;
|
||||
let basealias82: bool = false;
|
||||
if (bt82 != nil) {
|
||||
if (bt82.kind == tykind.TY_NAMED) { basealias82 = true; };
|
||||
};
|
||||
if (basealias82) {
|
||||
let bu82: *tinfo = tichase(bt82);
|
||||
if (bu82 != nil) {
|
||||
if (baselocal != nil) {
|
||||
isarr = bu82.kind == tykind.TY_ARRAY;
|
||||
};
|
||||
if (isglobalarr || isglobalptr) {
|
||||
isglobalarr = bu82.kind == tykind.TY_ARRAY;
|
||||
isglobalptr = !isglobalarr;
|
||||
};
|
||||
};
|
||||
};
|
||||
} else { if (base.kind == nkind.N_DOT
|
||||
|| (base.kind == nkind.N_UN
|
||||
&& base.op == tkind.TK_STAR)) {
|
||||
|
||||
Reference in New Issue
Block a user