diff options
Diffstat (limited to 'tests/bugs')
| -rw-r--r-- | tests/bugs/ir-null-parent-crash.slang | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/bugs/ir-null-parent-crash.slang b/tests/bugs/ir-null-parent-crash.slang new file mode 100644 index 000000000..ca4d0877d --- /dev/null +++ b/tests/bugs/ir-null-parent-crash.slang @@ -0,0 +1,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; +} |
