[spectec] Wasm 1.0: CVTOP typing accepts illegal conversion/operator combinations
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 66/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- wasm
- Domain
- compilers
Research direction
Start with the CVTOP typing rules in specification/wasm-1.0/6-typing.spectec and the syntax rule in specification/wasm-1.0/1-syntax.spectec. Compare the accepted combinations with the instruction forms listed in the issue's WebAssembly 1.0 PDF excerpt. Done means the rules reject illegal conversion and reinterpret combinations while accepting the listed legal forms; the issue does not name a test file.
Written by the indexing model from the issue text.
Description
The Wasm 1.0 SpecTec conversion typing rules accept arbitrary combinations of source type, destination type, and conversion operator.
In specification/wasm-1.0/6-typing.spectec:
;; TODO: move side conditions to syntax
rule Instr_ok/cvtop-reinterpret:
C |- CVTOP nt_1 nt_2 REINTERPRET : nt_2 -> nt_1
-- if $size(nt_1) = $size(nt_2)
rule Instr_ok/cvtop-convert:
C |- CVTOP nt_1 nt_2 cvtop : nt_2 -> nt_1
The second rule admits every cvtop, including REINTERPRET, so it also bypasses the first rule’s check.
The syntax rule only requires distinct source and destination types:
| CVTOP valtype_1 valtype_2 cvtop
hint(show %1.%3#_#%2)
-- if valtype_1 =/= valtype_2
The PDF (2.4.1) restricts those combinations through syntax:
nn, mm ::= 32 | 64
sx ::= u | s
instr ::= ...
| i32.wrap_i64
| i64.extend_i32_sx
| inn.trunc_fmm_sx
| f32.demote_f64
| f64.promote_f32
| fnn.convert_imm_sx
| inn.reinterpret_fnn
| fnn.reinterpret_inn
- Dominant language
- WebAssembly
- Stars
- 3.5k
- Forks
- 545
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 25
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from WebAssembly/spec
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
WebAssembly/spec#2321 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
WebAssembly/spec#2333 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
WebAssembly/spec#2330 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 53/100
WebAssembly/spec#2301 · 9 comments ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
WebAssembly/spec#2279 · 6 comments ·
Maintainers usually reply within 1 day
All issues in WebAssembly/spec
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
-
DAE2 crashes on call.without.effects with a non ref.func expressionPossibly taken @stevenfontanella claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
WebAssembly/binaryen#9404 ·
Maintainers usually reply within 1 day
-
area:compiler effort:S impact:med platform:windows type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
area:Analysis enhancement
Difficulty 1/5 1-3 hours Newbie friendliness 69/100
facebookresearch/atlas-lean#5118 ·
Maintainers usually reply within 1 day
-
C-bugfix
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Quantinuum/hugr#3354 ·
Maintainers usually reply within 1 day