Reject duplicate field names in structs#8396
Open
stevenfontanella wants to merge 4 commits intomainfrom
Open
Conversation
e4db0e1 to
ea8c955
Compare
ea8c955 to
e29c16b
Compare
kripken
reviewed
Feb 27, 2026
tlively
reviewed
Feb 27, 2026
|
|
||
| ;; Field names | ||
|
|
||
| ;; The below tests crash because (ref 0) fails to roundtrip. |
Member
There was a problem hiding this comment.
What kind of round tripping are we talking about here?
Member
Author
There was a problem hiding this comment.
In wasm-dis when trying to produce the text from the binary, we try to print an empty name and crash:
Running with 128 workers
wasm-dis: /usr/local/google/home/stevenfont/code/binaryen/src/support/name.cpp:44: std::ostream& wasm::Name::print(std::ostream&) const: Assertion `*this && "Cannot print an empty name"' failed.
Aborted spec test suite execution after first failure. Set --no-fail-fast to disable this.
Failed tests:
.. struct-upstream.wast
executing: /usr/local/google/home/stevenfont/code/binaryen/bin/wasm-shell /usr/local/google/home/stevenfont/code/binaryen/test/spec/struct-upstream.wast
testing split module 0
executing: /usr/local/google/home/stevenfont/code/binaryen/bin/wasm-opt test-spec-struct-upstream_split0.wast -O -all -q
(binary format check)
/usr/local/google/home/stevenfont/code/binaryen/bin/wasm-as test-spec-struct-upstream_split0.wast -o test-spec-struct-upstream-a.wasm -all -g
/usr/local/google/home/stevenfont/code/binaryen/bin/wasm-dis test-spec-struct-upstream-a.wasm -o test-spec-struct-upstream-ab.wast -all
Command '['/usr/local/google/home/stevenfont/code/binaryen/bin/wasm-dis', 'test-spec-struct-upstream-a.wasm', '-o', 'test-spec-struct-upstream-ab.wast', '-all']' died with <Signals.SIGABRT: 6>.
A smaller repro is by roundtripping this:
(module
(type (struct (field $x i32)))
(func (param (ref 0)) (result i32) (struct.get 0 $x (local.get 0)))
)AFAICT there's no logic for printing type indices instead of names when the type doesn't have a name, we'd need to add that.
Member
There was a problem hiding this comment.
Wow! Good thing we have spec tests :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #8261. Partially fixes struct.wast spec test.