Skip to content
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] compiler crash when casting types #4698

Closed
hannes-vernooij opened this issue Sep 30, 2022 · 2 comments
Closed

[SPIR-V] compiler crash when casting types #4698

hannes-vernooij opened this issue Sep 30, 2022 · 2 comments
Labels
needs-triage Awaiting triage

Comments

@hannes-vernooij
Copy link

hannes-vernooij commented Sep 30, 2022

Casting types with an identical size causes a segmentation fault.
https://shader-playground.timjones.io/03295c7334e11b732d4218543ebf47a4

struct A {
    uint data;
};

struct B {
    uint internalData0;
    uint internalData1;
    uint internalData2;
    uint internalData3;
};

struct C {
    A internalPackedAlbedo;
    uint internalData1;
    uint internalData2;
    uint internalData3;
};

[numthreads(8, 8, 1)] void main() {
    C diffuseLobe = (C)0;
    B lobe = (B)diffuseLobe;
}

It does compile successfully when A in struct C was defined as an uint instead of A.

@hannes-vernooij
Copy link
Author

hannes-vernooij commented Sep 30, 2022

It does compile when casting the other way around, B(diffuseLobe) instead of (B)diffuseLobe:

struct A {
    uint data;
};

struct B {
    uint internalData0;
    uint internalData1;
    uint internalData2;
    uint internalData3;
};

struct C {
    A internalPackedAlbedo;
    uint internalData1;
    uint internalData2;
    uint internalData3;
};

[numthreads(8, 8, 1)] void main() {
    C diffuseLobe = (C)0;
    B lobe = B(diffuseLobe);
}

@hannes-vernooij hannes-vernooij changed the title [SPIR-V] segmentation fault when casting types [SPIR-V] compiler crash when casting types Sep 30, 2022
@llvm-beanz llvm-beanz added the needs-triage Awaiting triage label Jun 29, 2023
@pow2clk
Copy link
Member

pow2clk commented Nov 16, 2023

In spite of the fact that shader playground still has a compiler that reproduces this, I find this no longer repros with spirv or dxil generation on my own builds and the most recent godbolt compilers:

https://godbolt.org/z/PG3cfsE8T

Please re-open if you find a repro in the latest compiler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage Awaiting triage
Projects
Archived in project
Development

No branches or pull requests

3 participants