[Migrated] asm reference to non-existent value causes ICE
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3.4k
- Forks
- 125
- PR merge metrics
- No merged PRs in 30d
Description
Issue automatically imported from old repo: https://github.com/EmbarkStudios/rust-gpu/issues/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
Contributor 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.
Research direction
Start by reproducing the malformed asm example with the unknown OpTypeInte instruction. Read crates/rustc_codegen_spirv/src/spirv_type.rs around line 674 and trace the lookup reached after the unknown-instruction error. Done means the input fails to compile with an error and no compiler panic or internal compiler error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100