Stream: git-wasmtime

Topic: wasmtime / Issue #1648 Cranelift: assertion failed: !self...


view this post on Zulip Wasmtime GitHub notifications bot (May 03 2020 at 17:19):

jyn514 opened Issue #1648:

(bash@joshua-ThinkPad-P51s) ~/.../rust/rcc ▶️ /bin/cat crash.c
void foo(void) {
  switch (1) {
    while(1)
      case 1:;
    case 0:;
  }
}
(bash@joshua-ThinkPad-P51s) ~/.../rust/rcc ▶️ cargo run crash.c --debug-asm
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s
     Running `/home/joshua/.local/lib/cargo/target/debug/rcc crash.c --debug-asm`
function u0:0() system_v {
; function 0: foo

    jt0 = jump_table [block5, block6]

block0:
    v0 = iconst.i64 1
    ; dummy
    jump block1

block2:
    jump block4

block4:
    v1 = bconst.b1 true
    ; while ((1) != ((long)(0)))
    brz v1, block5
    jump block6

; case 1
block6:
    ; loop start
    jump block4

; case 0
block5:
    ; end switch
    jump block3

block1:
    jump block7

block7:
    br_table.i64 v0, block3, jt0

block3:
    return
}

The application panicked (crashed).
Message:  assertion failed: !self.opcode().is_branch()
Location: /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-codegen-0.63.0/src/ir/instructions.rs:254

I don't know why this code doesn't work. It all seems valid to me and the panic doesn't tell me which instruction isn't valid. The verifier reports no errors and the panic happens only when defining the function.

cranelift 0.63.0

target is x86_64-unknown-linux-gnu

view this post on Zulip Wasmtime GitHub notifications bot (May 03 2020 at 17:19):

jyn514 labeled Issue #1648:

(bash@joshua-ThinkPad-P51s) ~/.../rust/rcc ▶️ /bin/cat crash.c
void foo(void) {
  switch (1) {
    while(1)
      case 1:;
    case 0:;
  }
}
(bash@joshua-ThinkPad-P51s) ~/.../rust/rcc ▶️ cargo run crash.c --debug-asm
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s
     Running `/home/joshua/.local/lib/cargo/target/debug/rcc crash.c --debug-asm`
function u0:0() system_v {
; function 0: foo

    jt0 = jump_table [block5, block6]

block0:
    v0 = iconst.i64 1
    ; dummy
    jump block1

block2:
    jump block4

block4:
    v1 = bconst.b1 true
    ; while ((1) != ((long)(0)))
    brz v1, block5
    jump block6

; case 1
block6:
    ; loop start
    jump block4

; case 0
block5:
    ; end switch
    jump block3

block1:
    jump block7

block7:
    br_table.i64 v0, block3, jt0

block3:
    return
}

The application panicked (crashed).
Message:  assertion failed: !self.opcode().is_branch()
Location: /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-codegen-0.63.0/src/ir/instructions.rs:254

I don't know why this code doesn't work. It all seems valid to me and the panic doesn't tell me which instruction isn't valid. The verifier reports no errors and the panic happens only when defining the function.

cranelift 0.63.0

target is x86_64-unknown-linux-gnu

view this post on Zulip Wasmtime GitHub notifications bot (May 03 2020 at 17:19):

jyn514 labeled Issue #1648:

(bash@joshua-ThinkPad-P51s) ~/.../rust/rcc ▶️ /bin/cat crash.c
void foo(void) {
  switch (1) {
    while(1)
      case 1:;
    case 0:;
  }
}
(bash@joshua-ThinkPad-P51s) ~/.../rust/rcc ▶️ cargo run crash.c --debug-asm
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s
     Running `/home/joshua/.local/lib/cargo/target/debug/rcc crash.c --debug-asm`
function u0:0() system_v {
; function 0: foo

    jt0 = jump_table [block5, block6]

block0:
    v0 = iconst.i64 1
    ; dummy
    jump block1

block2:
    jump block4

block4:
    v1 = bconst.b1 true
    ; while ((1) != ((long)(0)))
    brz v1, block5
    jump block6

; case 1
block6:
    ; loop start
    jump block4

; case 0
block5:
    ; end switch
    jump block3

block1:
    jump block7

block7:
    br_table.i64 v0, block3, jt0

block3:
    return
}

The application panicked (crashed).
Message:  assertion failed: !self.opcode().is_branch()
Location: /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-codegen-0.63.0/src/ir/instructions.rs:254

I don't know why this code doesn't work. It all seems valid to me and the panic doesn't tell me which instruction isn't valid. The verifier reports no errors and the panic happens only when defining the function.

cranelift 0.63.0

target is x86_64-unknown-linux-gnu

view this post on Zulip Wasmtime GitHub notifications bot (May 03 2020 at 17:20):

github-actions[bot] commented on Issue #1648:

Subscribe to Label Action

cc @bnjbvr

<details>
This issue or pull request has been labeled: "cranelift"

Thus the following users have been cc'd because of the following labels:

To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (May 03 2020 at 17:27):

jyn514 commented on Issue #1648:

<details><summary>Backtrace:</summary>

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                          (4 post panic frames hidden)
 4: cranelift_codegen::ir::instructions::InstructionData::branch_destination_mut::h9c17c2f91d91745e
    at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-codegen-0.63.0/src/ir/instructions.rs:254
 5: cranelift_codegen::ir::function::Function::change_branch_destination::h34e5352f443feafe
    at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-codegen-0.63.0/src/ir/function.rs:274
 6: cranelift_codegen::licm::create_pre_header::hab6d32d679ed4469
    at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-codegen-0.63.0/src/licm.rs:90
 7: cranelift_codegen::licm::do_licm::h90460effb4852ea5
    at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-codegen-0.63.0/src/licm.rs:43
 8: cranelift_codegen::context::Context::licm::ha20bea3caf3883c0
    at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-codegen-0.63.0/src/context.rs:362
 9: cranelift_codegen::context::Context::compile::h2eb376d6ffad127b
    at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-codegen-0.63.0/src/context.rs:172
10: cranelift_module::module::Module<B>::define_function::h838f26fe37268a15
    at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-module-0.63.0/src/module.rs:584
11: rcc::ir::Compiler<B>::compile_func::h5e9229dbdff90a19
    at /home/joshua/src/rust/rcc/src/ir/mod.rs:389

</details>

I cannot reproduce this crash with bugpoint.

(bash@joshua-ThinkPad-P51s) ~/.../rust/cranelift ▶️ git log --oneline | head -n 1
864cf98c8 Update release notes, wasmtime 0.16, cranelift 0.63.
(bash@joshua-ThinkPad-P51s) ~/.../rust/cranelift ▶️ cargo run bugpoint crash.clif --target x86_64-unknown-linux-gnu
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running `/home/joshua/.local/lib/cargo/target/debug/clif-util bugpoint crash.clif --target x86_64-unknown-linux-gnu`
Warning: Given function compiled successfully or gave a verifier error.

view this post on Zulip Wasmtime GitHub notifications bot (May 03 2020 at 17:40):

bjorn3 commented on Issue #1648:

Did you set opt_level=speed? This is probably https://github.com/bytecodealliance/wasmtime/issues/1080.

view this post on Zulip Wasmtime GitHub notifications bot (May 03 2020 at 17:56):

jyn514 commented on Issue #1648:

I did set opt_level=speed. With that I can reproduce with bugpoint:

$ cargo run bugpoint crash.clif --target x86_64-unknown-linux-gnu --set opt_level=speed
Crash message: assertion failed: !self.opcode().is_branch()

function u0:0() system_v {
    jt0 = jump_table [block5, block6]

block0:
    v0 = iconst.i64 1
    br_table v0, block3, jt0

block6:
    v1 = bconst.b1 false
    jump block6

block5:
    trap user0

block3:
    return
}

view this post on Zulip Wasmtime GitHub notifications bot (Dec 09 2020 at 04:19):

cfallin closed Issue #1648:

(bash@joshua-ThinkPad-P51s) ~/.../rust/rcc ▶️ /bin/cat crash.c
void foo(void) {
  switch (1) {
    while(1)
      case 1:;
    case 0:;
  }
}
(bash@joshua-ThinkPad-P51s) ~/.../rust/rcc ▶️ cargo run crash.c --debug-asm
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s
     Running `/home/joshua/.local/lib/cargo/target/debug/rcc crash.c --debug-asm`
function u0:0() system_v {
; function 0: foo

    jt0 = jump_table [block5, block6]

block0:
    v0 = iconst.i64 1
    ; dummy
    jump block1

block2:
    jump block4

block4:
    v1 = bconst.b1 true
    ; while ((1) != ((long)(0)))
    brz v1, block5
    jump block6

; case 1
block6:
    ; loop start
    jump block4

; case 0
block5:
    ; end switch
    jump block3

block1:
    jump block7

block7:
    br_table.i64 v0, block3, jt0

block3:
    return
}

The application panicked (crashed).
Message:  assertion failed: !self.opcode().is_branch()
Location: /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-codegen-0.63.0/src/ir/instructions.rs:254

I don't know why this code doesn't work. It all seems valid to me and the panic doesn't tell me which instruction isn't valid. The verifier reports no errors and the panic happens only when defining the function.

cranelift 0.63.0

target is x86_64-unknown-linux-gnu


Last updated: Nov 22 2024 at 16:03 UTC