Skip to content

Fix panic compiling an empty component with debug info - #14130

Merged
fitzgen merged 1 commit into
bytecodealliance:mainfrom
m0g3r:fix/14100-empty-component-debug-info
Aug 13, 2026
Merged

Fix panic compiling an empty component with debug info#14130
fitzgen merged 1 commit into
bytecodealliance:mainfrom
m0g3r:fix/14100-empty-component-debug-info

Conversation

@m0g3r

@m0g3r m0g3r commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #14100.

generate_simulated_dwarf unwrapped the first core-module translation to name its compilation unit, but a component with no core modules has no translations, so wasmtime compile -D debug-info=y panicked on a valid (component) input. Return early instead: with no translations there are no functions to describe.

generate_simulated_dwarf unwrapped the first core-module translation to
name its compilation unit, but a component with no core modules has no
translations, so `wasmtime compile -D debug-info=y` panicked on a valid
`(component)` input. Return early instead: with no translations there are
no functions to describe.
@m0g3r
m0g3r requested review from a team as code owners August 12, 2026 22:17
@m0g3r
m0g3r requested review from fitzgen and removed request for a team August 12, 2026 22:17

@fitzgen fitzgen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@fitzgen
fitzgen added this pull request to the merge queue Aug 13, 2026
Merged via the queue into bytecodealliance:main with commit a1f7d4c Aug 13, 2026
53 checks passed
alexcrichton added a commit that referenced this pull request Aug 14, 2026
* Fix panic compiling an empty component with debug info (#14130)

generate_simulated_dwarf unwrapped the first core-module translation to
name its compilation unit, but a component with no core modules has no
translations, so `wasmtime compile -D debug-info=y` panicked on a valid
`(component)` input. Return early instead: with no translations there are
no functions to describe.

* Run linker callback finalizers on invalid names (#14126)

* Shuffle more finalizers in the C API (#14133)

* Shuffle more finalizers in the C API

This implements a similar refactoring to #14126 but for the component
linker as well.

* Clang-format

* fix(wasmtime-cli): generic eio error thrown for wasip2 (#14107)

* Cranelift: unwind last-store state after removing a dead store (#14111)

Alias analysis's dead-store elimination removed the dead store's `mem_values`
entry, but left the region's last-store slot naming the instruction it had just
deleted. Leaving the removed-store meant that when we then reprocess the
overwriting store, we keyed its lookup on a removed instruction, found nothing,
and failed to notice that (for example) the overwriting store became idempotent
and could also be removed.

With this commit, each store now records the memory version it displaced, and
eliminating a dead store rolls that version back, so a chain like

    v1 = load.i32 region0 v0
    store region0 v2, v0  ;; dead
    store region0 v1, v0  ;; idempotent once the dead store is gone

collapses in the single pass we actually make, rather than removing only one
link in the chain and requiring that we do N passes to fully clean up a chain of
N dead/idempotent stores. This code pattern the shape fused sync adapters emit
around the `MAY_LEAVE` flag and the relevant disas tests each lose a store as a
result.

* Alias analysis: do not restore the last-fence into a region slot (#14134)

* Alias analysis: do not restore the last-fence into a region slot

When we eliminate a dead store, we undo the effects that the dead store had on
the `LastStore` state. However, querying the last store for a particular region
falls back to the last fence, and we were incorrectly restoring that last fence
into the region slot, rather than resetting the region slot to `None`. While
technically incorrect, it was generally benign, but it did lead to "observing"
instructions that we didn't mark observed during our initial observation pass,
which ultimately led to debug assertion failures.

Fixes #14131

* untrim whitespace in filetests

* Return is-directory when a directory fd is used as a file (#14135)

* wasip2: return is-directory when a directory fd is used as a file

Descriptor::file() treated a directory as a bad descriptor. POSIX
read/write on a directory is EISDIR, and wasi:filesystem already has
is-directory. Preview1 guests still get EBADF (separate match and
adapter).

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>

* wasip2: map is-directory only on read-via-stream

Descriptor::file() must stay bad-descriptor for directories.
wasi-testsuite filesystem-advise expects that for advise.
Return is-directory from read-via-stream only (p2 result, p3
result future) so a directory read matches POSIX EISDIR.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>

---------

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>

* Fix test expectations

---------

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
Co-authored-by: m0g3r <87276771+m0g3r@users.noreply.github.com>
Co-authored-by: grandpig <grandpig@outlook.com>
Co-authored-by: Eduardo de Moura Rodrigues <16357187+eduardomourar@users.noreply.github.com>
Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
Co-authored-by: Sebastien Tardif <SebTardif@ncf.ca>
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.

Empty Component Panics Native DWARF Compilation

2 participants