From 0257cb001b6f5c31e4ac0435d546fe638a17c48a Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 16 Oct 2025 11:52:38 -0700 Subject: 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. --- tests/bugs/gh-8659.slang | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/bugs/gh-8659.slang (limited to 'tests') 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 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 -- cgit v1.2.3