summaryrefslogtreecommitdiffstats
path: root/tests/bugs/ir-null-parent-crash.slang
blob: ca4d0877da2ae10a25534005364952d57a1006aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// ir-null-parent-crash.slang

// Test an issue where Slang was crashing on functions that
// have `static` variables with initializers.

//TEST:SIMPLE:-target hlsl

struct RNG
{
	uint state[2];
}

void jump(inout RNG rng)
{
    static uint32_t a[] = { 0x4, 0x2, 0x1, 0x3 };

    uint32_t s0 = 0;

    for (int i = 0; i < 4; i++)
    {
        s0 ^= rng.state[0];
    }

    rng.state[0] = s0;
}