microsoft / microsoft/DirectXShaderCompiler

[SPIR-V] SPV_EXT_descriptor_heap Heap alias assignment returns nullptr in expression context, propagating crash

Open Beginner friendly
#8,827 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage spirv
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.