summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-10-16 11:52:38 -0700
committerGitHub <noreply@github.com>2025-10-16 18:52:38 +0000
commit0257cb001b6f5c31e4ac0435d546fe638a17c48a (patch)
treec8a291aa21947528fe30b655d8140ddbbb63d010 /tests
parentbedc3421c9e1e0837fa69e30396a27a60f0fee53 (diff)
Fix wrong diagnostic when checking identical casting expr. (#8727)
`SemanticsVisitor::CheckInvokeExprWithCheckedOperands` made several references to `expr` parameter in its `inout` parameter l-value-ness validation logic to access arguments, which is wrong because `expr` is not necessarily the same as `result`/`invoke` (the result of calling `ResolveInvoke()` in the first line of the function. Changing it to `invoke` for consistency. Also add a special case logic to return early in case the resolved invoke expr is `argument[0]` when the original invoke expr is `T(funcThatReturnsT())`. Closes #8659.
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/gh-8659.slang16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/bugs/gh-8659.slang b/tests/bugs/gh-8659.slang
new file mode 100644
index 000000000..599c09b3b
--- /dev/null
+++ b/tests/bugs/gh-8659.slang
@@ -0,0 +1,16 @@
+//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly
+
+//TEST_INPUT: set ptr = ubuffer(data=[0 0 0 0], stride=4)
+uniform uint* ptr;
+
+//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0 0 0], stride=4)
+RWStructuredBuffer<uint> outputBuffer;
+
+[numthreads(1,1,1)]
+void computeMain()
+{
+ let indices = (uint*)&ptr[0];
+ *indices = 100;
+ // CHECK: 100
+ outputBuffer[0] = ptr[0];
+} \ No newline at end of file