Skip to content

transpile: fix zero initializer imports#1864

Open
thedataking wants to merge 1 commit into
masterfrom
perl/zero-init-imports
Open

transpile: fix zero initializer imports#1864
thedataking wants to merge 1 commit into
masterfrom
perl/zero-init-imports

Conversation

@thedataking

@thedataking thedataking commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Fix zero-initializer import replay when a cached initializer is reused from a reorganized submodule.

The initializer type import now participates in the deferred import set that is cached with the initializer. This prevents typedef names such as STAT_T from being emitted in a header module without the matching use.

Surfaced when working on PR #1861.

@thedataking thedataking marked this pull request as ready for review June 18, 2026 10:56
@thedataking thedataking added the bug Something isn't working label Jun 18, 2026
@fw-immunant

fw-immunant commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

From 1:1 discussion: I don't understand why this isn't a semantics-preserving change, given that beforehand we call import_type upfront (even on calls that will be cache hits), and afterward we defer imports and then do so (so that calling import_type does not directly modify the imports when called but rather adds these imports to the pending cache entry). It seems like both before and after this change, the imports added by import_type will be added on every call to zero_initializer and the only thing changing is whether they are read from the cache or not.

I'd like to see an explanation of what isn't true in the above understanding, or an example trace of how control/data flow works out for a particular case that makes it clear why this is a fix.

Does the attached test really fail without the accompanying change to zero_initializer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants