WebAssembly / WebAssembly/binaryen

Using two reloopers in one function can cause block name collisions.

Open
#5,466 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
8.6k
Forks
885
Avg merge
1d 19h
Merged PRs (30d)
69

Description

I am writing a WebAssembly compiler backing for the V programming language using binaryen.

I use reloopers/CFG to generate if statements, there can be many in one function. With only two if statements corresponding to two invokes of a relooper, validation fails with this error message below.

[wasm-validator error in function main.powi] unexpected false: names in Binaryen IR must be unique - IR generators must ensure that, on 
block$3$break

Is there a way to make all relooper blocks unique? I am using the C API, which AFAIK does not have ways to solve this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the reloopers/CFG path and its C API entry points, then reproduce the failure with two relooper invocations in one function. Check how Binaryen IR assigns block names and run the WebAssembly validator; done means the generated blocks have unique names and validation succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, wasm
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.