test: port 915/949 module-global access carriers to corpus fixtures

915_arr_module_index_run.c -> r915_arr_mod_idx0 (run), r915_arr_mod_
  idx2 (run-exit 1), r915_arr_mod_idx4 (run-exit 6); the single-file
  rows were already owned by r915_arr_local_* + test-data-byteid.
949_xmod_fnptr_const_run.c -> r949_xmod_fnptr_const_table (run),
  r949_xmod_fnptr_wrong_sig, r949_xmod_fnptr_nonfn_dotted (error
  'not assignable' both stages).

The 915 module rows upgrade from 994-delegated to per-fixture cs==ww
byte identity; 949's 2-file -I tree was not load-bearing — inline
packages exercise the same N_DOT &mod.fn mangle (mafn(leaf, module)).
This commit is contained in:
2026-08-08 14:30:26 +09:00
parent 5a8b662d6e
commit a4839d0176
9 changed files with 75 additions and 665 deletions

View File

@@ -0,0 +1,10 @@
//ww:run
// migrated from test/wcc/915_arr_module_index_run.c: cross-package mod.arr[0] — LEAQ base + u16 load width (#128b).
package wcmodarr;
export let probe_table: [8]u16 = [0u16, 0x0800u16, 0x0801u16, 0x0803u16, 0x1006u16, 0x1009u16, 0x100Du16, 0x1812u16];
package main;
import wcmodarr;
export fn main() i32 = {
let v: u32 = (wcmodarr.probe_table[0]: u32);
return v: i32;
};

View File

@@ -0,0 +1,10 @@
//ww:run-exit 1
// migrated from test/wcc/915_arr_module_index_run.c: nontrivial index — the pre-fix MOVQ-not-LEAQ segfault repro; 0x0801 mod 256 = 1.
package wcmodarr;
export let probe_table: [8]u16 = [0u16, 0x0800u16, 0x0801u16, 0x0803u16, 0x1006u16, 0x1009u16, 0x100Du16, 0x1812u16];
package main;
import wcmodarr;
export fn main() i32 = {
let v: u32 = (wcmodarr.probe_table[2]: u32);
return v: i32;
};

View File

@@ -0,0 +1,10 @@
//ww:run-exit 6
// migrated from test/wcc/915_arr_module_index_run.c: per-element stride pin; 0x1006 mod 256 = 6.
package wcmodarr;
export let probe_table: [8]u16 = [0u16, 0x0800u16, 0x0801u16, 0x0803u16, 0x1006u16, 0x1009u16, 0x100Du16, 0x1812u16];
package main;
import wcmodarr;
export fn main() i32 = {
let v: u32 = (wcmodarr.probe_table[4]: u32);
return v: i32;
};

View File

@@ -0,0 +1,23 @@
//ww:run
// migrated from test/wcc/949_xmod_fnptr_const_run.c: cross-module &cc.fn inside const table + scalar emits the &fn->DATAR reloc (#124); DISTINCT predicates catch a swapped reloc.
package cc;
export fn isa(c: rune) bool = { return c == 'a'; };
export fn isz(c: rune) bool = { return c == 'z'; };
package main;
import cc;
const tbl: [](str, *fn(c: rune) bool) = [(":a", &cc.isa), (":z", &cc.isz)];
const pf: *fn(c: rune) bool = &cc.isa;
export fn main() i32 = {
if (len(tbl) != 2) { return 10; };
let e0 = tbl[0];
let e1 = tbl[1];
let f0 = e0.1;
let f1 = e1.1;
if (!(*f0)('a')) { return 1; };
if ((*f0)('z')) { return 2; };
if (!(*f1)('z')) { return 3; };
if ((*f1)('a')) { return 4; };
if (!(*pf)('a')) { return 5; };
if ((*pf)('z')) { return 6; };
return 0;
};

View File

@@ -0,0 +1,8 @@
//ww:error "not assignable"
// migrated from test/wcc/949_xmod_fnptr_const_run.c: &cc.kval (an exported VAR) must not synthesize a *fn — the SK_FN gate stays narrow (#117 over-accept hazard).
package cc;
export let kval: int = 7;
package main;
import cc;
const t: [](str, *fn(c: rune) bool) = [(":k", &cc.kval)];
export fn main() i32 = { return len(t): i32; };

View File

@@ -0,0 +1,8 @@
//ww:error "not assignable"
// migrated from test/wcc/949_xmod_fnptr_const_run.c: cross-module &fn with a mismatched signature must not satisfy the declared *fn slot.
package cc;
export fn isa(c: rune) bool = { return c == 'a'; };
package main;
import cc;
const t: [](str, *fn(x: i32) i32) = [(":a", &cc.isa)];
export fn main() i32 = { return len(t): i32; };