summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/diagnostics/warning_operator_left_shift_overflow.slang27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/diagnostics/warning_operator_left_shift_overflow.slang b/tests/diagnostics/warning_operator_left_shift_overflow.slang
new file mode 100644
index 000000000..5c156a9b9
--- /dev/null
+++ b/tests/diagnostics/warning_operator_left_shift_overflow.slang
@@ -0,0 +1,27 @@
+//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target hlsl
+
+RWStructuredBuffer<int> inputBuffer;
+RWStructuredBuffer<int> outputBuffer;
+
+[numthreads(4, 1, 1)]
+void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
+{
+ uint8_t u8 = uint8_t(inputBuffer[0]);
+
+ uint result = (u8 << 0)
+ + (u8 << 1)
+ + (u8 << 2)
+ + (u8 << 3)
+ + (u8 << 4)
+ + (u8 << 5)
+ + (u8 << 6)
+ + (u8 << 7)
+ // CHECK-NOT: warning 41030:
+ // CHECK: ([[#@LINE+1]]): warning 41030: {{.*}}uint8{{.*}}8
+ + (u8 << 8)
+ // CHECK: ([[#@LINE+1]]): warning 41030: {{.*}}uint8{{.*}}9
+ + (u8 << 9)
+ ;
+
+ outputBuffer[0] = int(result);
+}