Skip to content

D198 (#3206): a function-pointer field's callee is proven only when the drafter can enumerate everything the proof depends on - #3212

Merged
ehartford merged 1 commit into
mainfrom
i3206
Nov 10, 2026
Merged

ehartford merged 1 commit into
mainfrom
i3206

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Implements Eric's ruling on #3206 shape A (D198, #3211). The callee of a call through a function-pointer field is proven only when the field is written in exactly one place, by a named package function, and its record never leaves what the drafter reads (no pointer to it passed to a function without a body here, none converted to another pointer type, every unit read). CImport.w collects every field write and record escape; CiFacadeDraft.w draws one verdict per Record.field. A proven field is its one function; an unproven one says which condition failed, which is what a registry fact must state. tools/facade_coverage.w clusters by condition.

On real code (glfw, pcre2, libpng) no field is proven, as the ruling expected for all but static single tables: the reports now read 'written in 2 places', 'a pointer to the record is passed to memset, which the proofs cannot read', and so on.

Fixtures: conan_facade_fnptr_field_proof_test (each condition), and the two existing dispatch fixtures, whose single static table is now proven. Shape B (the facts clause) is not in this PR: its spec words are drafted on #3206 and unblessed.

Battery GREEN on 7d1729e (with run tools/battery.w in ~/.local/with-staging/i3206, wall 437 s after a green gate and internals lane; GREEN BATTERY_DONE).

…he field is written in exactly one place, by a named package function, and its record never leaves what the drafter reads

Eric's ruling on #3206 shape A (D198): the closed-world 'every store in
the corpus' proof is refused; the callee of a call through a
function-pointer field is proven only under conditions the drafter can
enumerate. CImport.w collects, from every definition and every variable
initializer, each write of a function-pointer field (an assignment, a
positional or designated initializer entry), each pointer to a record
passed to a callee, each conversion of such a pointer, and each field
address taken (ci_fnptr_field_evidence; lines carry their location, so a
header's table counts once). CiFacadeDraft.w draws one verdict per
Record.field: proven when there is exactly one write, it names a function
whose body the proofs read, the record is passed only to such functions
(or free), no pointer to it is converted, and every unit was read.

A proven field is its one function: retention, destruction and the
return are that function's. An unproven one says which condition failed,
which is what a registry fact must state: 'written in 2 places (show_a,
show_b)', 'a pointer to the record is passed to memset, which the proofs
cannot read', 'the package never writes it (its value is the caller's)'.
Sinks name the field with its record (`*Record.field`).

tools/facade_coverage.w clusters the reasons by condition.

Fixtures: conan_facade_fnptr_field_proof_test (each condition);
conan_facade_dispatch_sink_test and conan_facade_jump_table_callee_test
now see their single static table proven (the first finds the real
retention behind it, the second presents its producer and destroyer).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant