-
Notifications
You must be signed in to change notification settings - Fork 686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPIR-V] DXC crashes when declaring a variable in multiple case block #6718
Comments
shobomaru
added
bug
Bug, regression, crash
needs-triage
Awaiting triage
spirv
Work related to SPIR-V
labels
Jun 22, 2024
Thanks for the issue! Repro: // RUN: %dxc -T cs_6_6 %s -E main -fcgl -spirv | FileCheck %s
[numthreads(1, 1, 1)]
void main()
{
uint a = 0;
[branch]
switch (a) {
default: return;
case 1: {
uint d1;
}
}
} Looks like this is caused by our code to map variable to declaration: we process 2
But because of the
|
Keenuts
added a commit
to Keenuts/DirectXShaderCompiler
that referenced
this issue
Jul 9, 2024
When the [branch] annotation is used, switches are converted into an if/else tree. Issue arise when declaring a variable into a switch case: - when flattened, the same variable could be traversed twice in case of a case fall-through. In addition, there was a small bug in the flattening logic: only breaks were stopping the handling of further statements, while early-returns were ignored. This was not an important bug as it only added more dead-code, but it was wrong. Fixes microsoft#6718 Signed-off-by: Nathan Gauër <brioche@google.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
LLVM assertion failed.
Steps to Reproduce
dxc -T cs_6_0 -spirv path/to/file.hlsl
HLSL code:
If change the code in one of the following ways, the issue is not occurred.
[branch]
uint d = a + 1;
oruint d1 = a + 2;
(in other words, only declaring one variable in the switch statement)Actual Behavior
Environment
The text was updated successfully, but these errors were encountered: