Skip to content

Commit 664d3b7

Browse files
committed
Adding more test case
1 parent d69ae14 commit 664d3b7

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tests/diagnostics/uninitialized-variable-name-in-error-message.slang

+13-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
RWStructuredBuffer<float> gInput;
77
RWStructuredBuffer<float> outputBuffer;
88

9+
//CHK-DAG: ([[#@LINE+1]]): warning 41016: use of uninitialized variable 'a'
10+
float func1() { float a; return a; }
11+
12+
//CHK-DAG: ([[#@LINE+1]]): warning 41016: use of uninitialized variable 'b'
13+
float func2() { float b; return b; }
14+
915
int test(int inVal)
1016
{
1117
return inVal;
@@ -16,12 +22,16 @@ int test(int inVal)
1622
void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
1723
{
1824
int tid = dispatchThreadID.x;
19-
int inVal; // = tid; // intentionally uninitialized
25+
int inVal1; // intentionally uninitialized
26+
int inVal2; // intentionally uninitialized
2027

2128
for (int i = 0; i <2; ++i)
2229
{
23-
// CHK: ([[#@LINE+1]]): warning 41016: use of uninitialized variable 'inVal'
24-
int outVal = test(inVal);
30+
// CHK-DAG: ([[#@LINE+1]]): warning 41016: use of uninitialized variable 'inVal1'
31+
int outVal = test(inVal1);
32+
33+
// CHK-DAG: ([[#@LINE+1]]): warning 41016: use of uninitialized variable 'inVal2'
34+
outVal += test(inVal2);
2535
outputBuffer[tid] = outVal;
2636
}
2737
}

0 commit comments

Comments
 (0)