summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/assign-nullptr.slang14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/bugs/assign-nullptr.slang b/tests/bugs/assign-nullptr.slang
new file mode 100644
index 000000000..aa9763e17
--- /dev/null
+++ b/tests/bugs/assign-nullptr.slang
@@ -0,0 +1,14 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry computeMain -O0
+
+//CHECK: %[[NULLPTR_VAL:[a-zA-Z0-9_]+]] = OpConvertUToPtr %_ptr_PhysicalStorageBuffer_int %{{.*}}
+//CHECK: OpStore %ptr %[[NULLPTR_VAL]]
+
+[vk::push_constant] int* dest;
+[numthreads(1, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int* ptr = nullptr;
+ if (dispatchThreadID.x % 2 == 0) ptr = dest;
+ if (ptr) *ptr = 123;
+
+}