Skip to content

#3175: a parameter's local alias is no global store, and a write to the parameter's own variable stores nothing - #3200

Merged
ehartford merged 2 commits into
mainfrom
i3174
Nov 9, 2026
Merged

ehartford merged 2 commits into
mainfrom
i3174

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Part of #3175 (two of its shapes). The call-evidence walker now knows the body's locals, so str = buf is an alias, not a store into a global ('stored in a global', 187 functions); and the ownership walk records nothing for a write into a parameter's own variable (buf = (const unsigned char *)words, 'stored through local words'). Fixture conan_facade_local_alias_not_global_test. Gate and internals lane green on the first commit; the full chain on both is running.

Eric Hartford added 2 commits November 9, 2026 00:34
… store into a global

The call-evidence walker knew a body's parameters but not its locals, so
`str = buf` (zlib's gzgets: the output cursor) read as the parameter
stored into a global and the function stayed raw: 'retains param 1
(stored in a global)', 187 functions in 14 libraries of the #3116
survey. The walker now carries the body's locals (ci_own_collect_locals,
as the ownership walk does) and only a name that is neither a parameter
nor a local is a global.

Fixture: conan_facade_local_alias_not_global_test (a local alias is no
store; a true file-scope store still is).
zlib's crc32_z walks the buffer through an alias (`words = (z_word_t
const *)buf`) and at the end writes the alias back into the parameter
(`buf = (const unsigned char *)words`). The ownership walk recorded the
right-hand local as stored, so the parameter read as retained 'through
local words' and crc32 and crc32_z stayed raw (165 functions in 13
libraries read 'stored through a local' in the #3116 survey; this is one
of its shapes). A parameter variable is the callee's frame: a value
written into it outlives nothing.

Fixture: conan_facade_local_alias_not_global_test's thing_fill rebinds
buf from its alias.
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on a10f581 (with run tools/battery.w in ~/.local/with-staging/i3174, wall 370 s after a green gate and internals lane; status: GREEN BATTERY_DONE).

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