microsoft / microsoft/DirectXShaderCompiler
Casting subclass to parent of three class heirarchy causes crashes
Open
Nobody has claimed this yet.
bug
check-in-clang
crash
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
The following shader which attempts to cast a variable of type C to its immediate parent, type B while passing an argument crashes DXC. If the only classes are B and C, this works fine. If there is a parent class to B, then it fails. Passing the argument as class C works fine as well.
struct A {
float4 stuff;
};
struct B : A {
float4 gimme() {return stuff;}
};
struct C : B {
void dostuff() {stuff = 0;}
};
float4 f(B thing1) { // THIS IS THE PROBLEM
return thing1.gimme();
}
float4 main() : SV_Target
{
C thing2;
thing2.stuff = float4(1,2,3,4);
return f(thing2);
}
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 by compiling the provided shader with DXC and use main plus f(B thing1) as the reproduction entry points. Trace the C-to-B argument conversion through the A/B/C hierarchy; done means this case no longer crashes and returns the initialized value.
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
- Clearly specified
- Newbie friendliness
- 35/100