microsoft / microsoft/DirectXShaderCompiler
[SPIR-V] SPV_EXT_descriptor_heap Heap alias assignment returns nullptr in expression context, propagating crash
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
In tryToAssignToDescriptorHeapAlias (SpirvEmitter.cpp), when an assignment is rejected due to mixed bound/heap aliasing and the destination is a buffer or AS alias, a raw nullptr is returned as the SpirvInstruction* result. doBinaryOperator propagates this via aliasResult.getValue(). If the assignment appears inside a larger expression rather than as a standalone statement, the null instruction reaches downstream builder logic and causes a crash, even though an error was already emitted.
Fix
Return spvBuilder.getUndef(assignExpr->getType()) instead of static_cast<SpirvInstruction *>(nullptr) on the consumed-assignment path so codegen can continue safely after the diagnostic.
References
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 in SpirvEmitter.cpp at tryToAssignToDescriptorHeapAlias and trace how doBinaryOperator uses aliasResult.getValue(). Exercise the mixed bound/heap aliasing case inside a larger expression, then verify that the diagnostic is emitted while code generation continues without a null-instruction crash. Done means the consumed-assignment path safely produces an undefined value of the assignment type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100