Repository navigation
Fix operand arity of v128.storeN_lane in GetExprArity - #2764
Conversation
| ;; first local.get must survive as a separate return value rather than being | ||
| ;; folded into the store. | ||
| (func (param i32 v128) (result i32 i32) | ||
| local.get 0 |
There was a problem hiding this comment.
I would prefer an f32 arg for stack value testing purposes (i32 is too common as a result), but the patch is ok this way.
There was a problem hiding this comment.
Good point. Switched the surviving value to an f32 arg so it stands out from the i32 address. The store still consumes the i32/v128 pair and the float drops out as its own return value.
|
any update? |
|
The patch is ok for me. @sbc100 what do you think? |
| @@ -0,0 +1,32 @@ | |||
| ;;; TOOL: run-wasm-decompile | |||
There was a problem hiding this comment.
wasm-decompile was removed from wabt so I guess this test needs to be changed in some way?
There was a problem hiding this comment.
Right, rebased past the decompiler removal and reworked the test. GetExprArity still drives wasm2wat --fold-exprs, and the phantom result is observable there too: the writer folds the store into the next consumer and strands the value beneath it. Replaced the decompile test with test/roundtrip/fold-simd-store-lane.txt (kept the f32 stack value). It fails with the shared {2, 1} case and passes with the split one; the rest of test/roundtrip still passes locally.
wasm-decompile was removed, so the decompile-based regression test no longer runs. GetExprArity still drives wasm2wat --fold-exprs: the phantom store_lane result made the writer fold the store into the next consumer and orphan the value beneath it. Replace the test with a run-roundtrip fold test covering the same case.
Found this fuzzing wasm-decompile under a debug build: a valid module whose only instruction is v128.store8_lane aborts on the value-stack assert in decompiler-ast.h Construct.
The decompiler has since been removed, but GetExprArity still drives the folded wat writer, where the phantom result is equally observable: wasm2wat --fold-exprs folds the store into the next value consumer and strands the value beneath it. Split the case so SimdStoreLane returns {2, 0} and SimdLoadLane keeps {2, 1}. A reduced repro is added under test/roundtrip.