cranelift: Restrict br_table to i32 indices (#4510)
* cranelift: Restrict `br_table` to `i32` indices In #4498 it was proposed that we should only accept `i32` indices to `br_table`. The rationale for this is that larger types lead the users to a false sense of flexibility (since we don't support jump tables larger than u32's), and narrower types are not well tested paths that would be safer if we removed them. * cranelift: Reduce directly from i128 to i32 in Switch
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
test verifier
|
||||
|
||||
function %br_invalid_default(i64) {
|
||||
function %br_invalid_default(i32) {
|
||||
jt0 = jump_table [block1, block1]
|
||||
|
||||
block0(v0: i64):
|
||||
br_table.i64 v0, block2, jt0 ; error: invalid block reference block2
|
||||
block0(v0: i32):
|
||||
br_table v0, block2, jt0 ; error: invalid block reference block2
|
||||
block1:
|
||||
return
|
||||
}
|
||||
|
||||
function %br(i64) {
|
||||
function %br(i32) {
|
||||
jt0 = jump_table [block1, block2] ; error: invalid block reference block2
|
||||
|
||||
block0(v0: i64):
|
||||
br_table.i64 v0, block1, jt0
|
||||
block0(v0: i32):
|
||||
br_table v0, block1, jt0
|
||||
block1:
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user