Closed MarijnS95 closed 1 year ago
Just going to drop a full-source example here:
RWByteAddressBuffer buffer;
void interlockWrapper(out uint original) {
buffer.InterlockedAdd(16, 1, original);
}
Something to also be aware of here. -Wuninitialized
in DXC does cause spurious warnings around struct types too. We also have issue #2494, which is caused by our bad AST hygiene.
A recent PR to prevent leaving
out
parameters uninitialized in function calls (https://github.com/microsoft/DirectXShaderCompiler/pull/5047) seems to have escaped its cage and is now also disallowing uninitialized arguments into functions without
paramameters. See for example this (IMO totally valid)Interlocked*
invocation:(Compiler from https://github.com/microsoft/DirectXShaderCompiler/commit/667fb773cc2fb40bc31dba6d53e5230a196838ff)
I thought the whole point of
out
parameters and by extension this diagnostic is to know and force that the function will initializeoriginal
here, and it should thus not need to be pre-initialized by the caller.Originally posted by @MarijnS95 in https://github.com/microsoft/DirectXShaderCompiler/issues/5047#issuecomment-1462949361, cc @llvm-beanz