diff --git a/selfhost/cmd/w6c/main.combined.ww b/selfhost/cmd/w6c/main.combined.ww index 82ce2955..9c698388 100644 --- a/selfhost/cmd/w6c/main.combined.ww +++ b/selfhost/cmd/w6c/main.combined.ww @@ -20771,17 +20771,21 @@ fn cgstructlitfill(c: *cgen, si: *structinfo, lit: *node, let elemn: *node = fi.tnode.lhs; let isstrel: bool = isstrtype(c, elemn); let istagel: bool = istaggedtype(c, elemn); - let issliceel: bool = false; + let issliceel: bool = isslicetype(c, elemn); + // #100: key the loud gate off the CHASED stamped + // tinfo (tichase, the tnodeisagg discipline), not + // the raw tnode — a bare N_TSLICE kind test / + // structlookup leaf-name probe is alias-blind, so + // `type el = el0;` bypassed the gate and fell to + // the scalar tail (silent wrong, ken kb5_fill2). + // Twin of cstage cg_structlit_fill's + // type_chase_named key (cgen.c:3179, B5-c1). let isstructel: bool = false; if (elemn != nil) { - if (elemn.kind == nkind.N_TSLICE) { - issliceel = true; - }; - if (elemn.kind == nkind.N_TNAME) { - if (primsize(elemn.str) == 0) { - if (structlookup(c, elemn.str) != nil) { - isstructel = true; - }; + let eu: *tinfo = tichase(elemn.type_: *tinfo); + if (eu != nil) { + if (eu.kind == tykind.TY_STRUCT) { + isstructel = true; }; }; }; diff --git a/selfhost/cmd/wcc/cgenutil.ww b/selfhost/cmd/wcc/cgenutil.ww index 93b4ffd4..f7ae639f 100644 --- a/selfhost/cmd/wcc/cgenutil.ww +++ b/selfhost/cmd/wcc/cgenutil.ww @@ -4682,17 +4682,21 @@ fn cgstructlitfill(c: *cgen, si: *structinfo, lit: *node, let elemn: *node = fi.tnode.lhs; let isstrel: bool = isstrtype(c, elemn); let istagel: bool = istaggedtype(c, elemn); - let issliceel: bool = false; + let issliceel: bool = isslicetype(c, elemn); + // #100: key the loud gate off the CHASED stamped + // tinfo (tichase, the tnodeisagg discipline), not + // the raw tnode — a bare N_TSLICE kind test / + // structlookup leaf-name probe is alias-blind, so + // `type el = el0;` bypassed the gate and fell to + // the scalar tail (silent wrong, ken kb5_fill2). + // Twin of cstage cg_structlit_fill's + // type_chase_named key (cgen.c:3179, B5-c1). let isstructel: bool = false; if (elemn != nil) { - if (elemn.kind == nkind.N_TSLICE) { - issliceel = true; - }; - if (elemn.kind == nkind.N_TNAME) { - if (primsize(elemn.str) == 0) { - if (structlookup(c, elemn.str) != nil) { - isstructel = true; - }; + let eu: *tinfo = tichase(elemn.type_: *tinfo); + if (eu != nil) { + if (eu.kind == tykind.TY_STRUCT) { + isstructel = true; }; }; }; diff --git a/selfhost/cmd/wwdump/main.combined.ww b/selfhost/cmd/wwdump/main.combined.ww index 495ca11d..4dfe08c2 100644 --- a/selfhost/cmd/wwdump/main.combined.ww +++ b/selfhost/cmd/wwdump/main.combined.ww @@ -20771,17 +20771,21 @@ fn cgstructlitfill(c: *cgen, si: *structinfo, lit: *node, let elemn: *node = fi.tnode.lhs; let isstrel: bool = isstrtype(c, elemn); let istagel: bool = istaggedtype(c, elemn); - let issliceel: bool = false; + let issliceel: bool = isslicetype(c, elemn); + // #100: key the loud gate off the CHASED stamped + // tinfo (tichase, the tnodeisagg discipline), not + // the raw tnode — a bare N_TSLICE kind test / + // structlookup leaf-name probe is alias-blind, so + // `type el = el0;` bypassed the gate and fell to + // the scalar tail (silent wrong, ken kb5_fill2). + // Twin of cstage cg_structlit_fill's + // type_chase_named key (cgen.c:3179, B5-c1). let isstructel: bool = false; if (elemn != nil) { - if (elemn.kind == nkind.N_TSLICE) { - issliceel = true; - }; - if (elemn.kind == nkind.N_TNAME) { - if (primsize(elemn.str) == 0) { - if (structlookup(c, elemn.str) != nil) { - isstructel = true; - }; + let eu: *tinfo = tichase(elemn.type_: *tinfo); + if (eu != nil) { + if (eu.kind == tykind.TY_STRUCT) { + isstructel = true; }; }; }; diff --git a/test/wcc/944_alias_cgen_b5_run.c b/test/wcc/944_alias_cgen_b5_run.c index f12be296..d259cec9 100644 --- a/test/wcc/944_alias_cgen_b5_run.c +++ b/test/wcc/944_alias_cgen_b5_run.c @@ -45,12 +45,12 @@ * fill0_ctl | kb5_fill0: named-struct array elem | * | in struct lit — LOUD both stages | * | (twin texts share the experr) | err/err - * fill2_bound100 | kb5_fill2: 1-alias-lvl elem — was | - * | both-wrong-IDENTICAL gate-blind; c1 | - * | :3195 chase flips cs LOUD, ww stays | - * | silent-wrong exit 1. DESIGNED | - * | DIVERGENCE until the ww twin gate | - * | (task #100) lands — dual-cell pin | err/1 + * fill2_loud | kb5_fill2: 1-alias-lvl elem — was | + * | both-wrong-IDENTICAL gate-blind, | + * | then cs-loud/ww-silent for the one | + * | R4-blessed train; #100's ww twin | + * | chase closed the window — LOUD-HOLD | + * | pair, twin texts share the experr | err/err * tuparg_bound99 / | kb5_tuparg(1): literal named-tuple | * tuparg1_bound99 | arg — cs checker-rejects (#86-kin), | * | WW RUNS WRONG exit 1 (task #99, | @@ -349,14 +349,14 @@ static const struct row rows[] = { " return 0;\n" "};\n", 0, 0, K_BUILDERR, "has a str/slice/struct/tagged element" }, - /* DESIGNED IN-TRAIN ACCEPTANCE DIVERGENCE (B5 re-rule R4, task - * #100): pre-c1 this was both-wrong-IDENTICAL-silent (gate-blind - * #263 class — both stages accepted and ran exit 1 byte-id). The - * cs-only :3195 chase flips cs to the fill0 fatal; ww's own - * alias-blind twin gate (checkarrlitfits kin) stays silent-wrong - * until #100 lands — then this row graduates to a both-loud - * fill0-class pair. Both cells asserted. */ - { "fill2_bound100", + /* #100 GRADUATION (closes the B5 re-rule R4 designed divergence): + * pre-B5 this was both-wrong-IDENTICAL-silent (gate-blind #263 + * class — both stages accepted and ran exit 1 byte-id); B5-c1's + * cs-only :3195 chase made it cs-loud/ww-silent-wrong for one + * train. The ww twin gate now keys off the chased stamped tinfo + * (cgenutil.ww, task #100) — LOUD-HOLD pair, twin texts share + * the experr tail (fill0-class). */ + { "fill2_loud", "package main;\n" "type el0 = struct { a: i64 };\n" "type el = el0;\n" @@ -365,8 +365,8 @@ static const struct row rows[] = { " let s = S { arr = [el0 { a = 5 }, el0 { a = 6 }], n = 3 };\n" " if (s.arr[0].a + s.arr[1].a + s.n != 14) { return 1; };\n" " return 0;\n" - "};\n", 0, 1, K_CSERR_WWRUN, - "has a str/slice/struct/tagged element" }, /* ww: task #100 */ + "};\n", 0, 0, K_BUILDERR, + "has a str/slice/struct/tagged element" }, /* node_tuplearg:249 pin (ken FLAG-2): the LITERAL spelling has * NO GREEN TARGET — cs checker-rejects even at 1 level (#86-kin) * while WW ACCEPTS AND RUNS WRONG (exit 1, task #99 metric-1