Rust-GPU/rust-gpu

[Migrated] asm reference to non-existent value causes ICE

Opened this issue · 0 comments

Issue automatically imported from old repo: EmbarkStudios/rust-gpu#518
Old labels: t: bug,a: ice,a: error messages,a: asm
Originally creatd by XAMPPRocky on 2021-03-22T07:37:30Z


If you pass a reference to malformed instruction, it will cause the compiler to panic, when it should fail just fail to compile.

Rust

#[spirv(fragment)]
pub fn foo() {
    asm! {
        "%u32 = OpTypeInte 32 0",
        "%zero = OpConstant %u32 0",
}

Error

error: unknown spirv instruction OpTypeInte
  --> /Users/erin.power/src/rust-gpu2/crates/spirv-std/src/arch/barrier.rs:5:5
   |
5  | /     asm! {
6  | |         "%u32 = OpTypeInte 32 0",
7  | |         "%execution = OpConstant %u32 {execution}",
8  | |         // "%memory = OpConstant %u32 {memory}",
...  |
13 | |         // semantics = const SEMANTICS as u8,
14 | |     }
   | |_____^

thread 'rustc' panicked at 'Tried to lookup value that wasn't a type, or has no definition', crates/rustc_codegen_spirv/src/spirv_type.rs:674:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic