microsoft / microsoft/DirectXShaderCompiler

Internal Compiler error (argument of incompatible type) when using Buffer as a buffer name

Open
#7,921 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug crash diagnostic
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Description
Following simple compute shader fails to compile:

RWByteAddressBuffer Buffer : register(u0);
[numthreads(1, 1, 1)]
void mainCS(uint3 dtid: SV_DispatchThreadID) {
    uint value = Buffer.Load(123);
}

Steps to Reproduce
Compile the shader with command line:

dxc.exe -T cs_6_0 -E mainCS -Fo MyCS.dxil MyCS.hlsl

Actual Behavior

Internal Compiler error: llvm::cast<X>() argument of incompatible type!

Changing the name of the buffer to something else like Buffer solves the problem.

I understand that I shouldn't use word Buffer for the name of my buffer, but I suggest outputting some more descriptive error message, communicating more directly what is wrong about the shader code.

Environment

  • DXC version: dxcompiler.dll: 1.8 - 1.8.2502.11 (239921522); dxil.dll: 1.8(1.8.2502.11), as bundled in Windows SDK 10.0.26100.0.
  • Host Operating System: Windows 11 x86-64 25H2 (OS Build 26200.7171)

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 by reproducing the shader with dxc.exe using the command and DXC version given, then trace how the identifier Buffer is handled during compilation. Done means the shader no longer produces an LLVM cast internal compiler error and instead reports a descriptive diagnostic about the invalid name.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.