You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
migrate: nullable-by-evidence function-pointer parameters as a corpus fixed point (D107); the migrator is NON-COMPLIANT until this lands #2240
D107 (2026-10-06, Eric) rules that a migrated definition's function-pointer parameter is Option by evidence, computed as a least fixed point over the corpus, with system-header prototypes under D102 unchanged. The shipped migrator wraps by declaration site (ClangBridge.w migration-session rule, PR #2218) and is non-compliant.
Implementation (conforming projection in the D107 entry and ffi.md §16.6):
CiProject gains the evidence pass over every scanned unit: per corpus definition and parameter, (a) a body NULL test whose NULL branch continues (p == NULL, p != NULL, !p, if (p), p ? :) → Option; a test whose NULL branch aborts (assert(p), abort()/exit()/__builtin_trap()) → evidence of non-null; (b) a corpus call site passing NULL or a null-like (T)0 at that position → Option; (c) passing p to an Option parameter of a corpus definition, storing it into a record field, or assigning it to a nullable global → Option (the fixed point).
Least fixed point: start non-null, add Option from (a)/(b), iterate (c) to closure; an unanalyzable body or a dependency with no corpus definition (outside system headers) is Option; cycles are Option for every member. Deterministic in the corpus, never in unit order.
The bridge stops wrapping parameters in migration sessions; CImport renders the signature and the body copy from the project's verdict (one owner).
Each verdict prints its reason (f param 2: Option: body tests at line N / Option: caller g at X passes NULL / Option: passed to h param 1 / non-null: called unconditionally, no NULL callers) in the migration log and the shared defs manifest.
Fixtures: bs_check_migrate_nullable_fn_pointer gains the handled-test, assert, NULL-caller, field-store and non-null cases; corpora re-migrated, audited with tools/migrate_diff.w, re-promoted.
Battery #3 on #2243 found a hole in the evidence pass: NULL callers inside static definitions were never recorded (the scan skipped static functions before recording evidence), so pcre2test's own pcre2_jit_stack_assign(ctx, NULL, NULL) and pcre2_set_recursion_memory_management(ctx, NULL, NULL, NULL) went unseen and both setters migrated non-null — the stored-bundle drift harness then refused the corpus's own null. Fixed: every static definition's body contributes NULL-caller evidence (record_call_evidence); the corpora re-migrate; the harness edit is reverted (the parameters are Option again, by evidence).
Activity
ehartford commentedon Oct 7, 2026
Implemented on PR #2243 (717bf6b): evidence pass + least fixed point in
CiProject, bridge wrap removed,ci_migrated_param_typethe one render site, NULL-comparison fold for non-null parameters, reasons printed, fixture with the five cases. Corpora re-promoted;migrate_diffper corpus: pcre2 4 functions (pcre2test), zlib 1 file (inflateBack's callbacks non-null), tommyds 5 test functions, c_algorithms 4 files (list_sort/arraylist/slist callbacks, run_test).pcre2_set_calloutkeepsOption(NULL callers). Battery pending.ehartford commentedon Oct 7, 2026
Battery #3 on #2243 found a hole in the evidence pass: NULL callers inside
staticdefinitions were never recorded (the scan skipped static functions before recording evidence), so pcre2test's ownpcre2_jit_stack_assign(ctx, NULL, NULL)andpcre2_set_recursion_memory_management(ctx, NULL, NULL, NULL)went unseen and both setters migrated non-null — the stored-bundle drift harness then refused the corpus's ownnull. Fixed: every static definition's body contributes NULL-caller evidence (record_call_evidence); the corpora re-migrate; the harness edit is reverted (the parameters are Option again, by evidence).migrate: a definition's function-pointer parameter is Option by evide…