microsoft / microsoft/DirectXShaderCompiler
`register` declaration applied to member of a `cbuffer` should be an error
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
You can apply bogus register declarations on members of a cbuffer as long as they correspond to the legacy constant registers, i.e. b#, c# or i#. Register spaces can be applied too.
Steps to Reproduce
https://hlsl.godbolt.org/z/5vr9xEd66
Actual Behavior
All of these do nothing and make no logical sense, but are accepted by DXC and emit no diagnostics at all.
Clang does error on almost all of them (with different reasons depending on register type), except if you only supply register space.
Environment
- DXC version: 1.6+
- Host Operating System: All
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 with the HLSL Compiler Explorer reproduction at https://hlsl.godbolt.org/z/5vr9xEd66 and compare DXC's diagnostics with Clang's for register declarations on cbuffer members. Trace the relevant parser or semantic-validation entry point, then add coverage showing that bogus register declarations and register spaces produce diagnostics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100