microsoft / microsoft/DirectX-Headers

Use of CD3DX12_CPU_DESCRIPTOR_HANDLE in an array can result in static analysis warning

Open
#6 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

d3dx12 not our bug
Dominant language
C
Stars
743
Forks
202
Avg merge
5d 10h
Merged PRs (30d)
2

Description

Please see this godbolt output https://godbolt.org/z/ozYG6e

If you create an uninitialized array of CD3DX12_CPU_DESCRIPTOR_HANDLE and then initializing the array in a loop with objects of type D3D12_CPU_DESCRIPTOR_HANDLE, it results in a static analysis error on the usage of the uninitialized array. This does not happen with a non-array.

It actually looks like changing just the custom assignment operator can fix this, if you "= default" the "=" operator, the warning goes away. For context, this warning looks like it was introduced when all the constructors were changed from "{}" (empty implementations) to "= default".

Contributor guide

No contributing guide indexed for this repository

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 with the linked Godbolt output and inspect the CD3DX12_CPU_DESCRIPTOR_HANDLE constructors and custom assignment operator. Reproduce the static-analysis warning for an uninitialized array initialized in a loop, then verify that the warning is gone without affecting the non-array case.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.