Skip to content

Malformed SPIRV after assignment to mutable reference #178

Open
@FractalFir

Description

@FractalFir

Issue originally found by rustlantis.

This reduced example:

#![no_std]
use spirv_std::spirv;
#[spirv(compute(threads(1)))]
pub fn fn1(#[spirv(storage_buffer, descriptor_set = 0, binding = 0)] mut addr: &mut f32) {
    addr = addr;
    (*addr) = 0.0;
}

Results in invalid SPIR-V:

error: malformed SPIR-V (in OpStore: undefined ID %33)
  |
  = note: while lowering SPIR-V module to SPIR-T (spirt::spv::lower)
  = note: input SPIR-V module was saved to /home/michal/rust-gpu/target/spirv-builder/spirv-unknown-vulkan1.1/release/deps/sky_shader.spirt-lower-from-spv-input.spv

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions