diff options
| author | Yong He <yonghe@outlook.com> | 2023-05-31 12:36:48 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-31 12:36:48 -0700 |
| commit | 5dd401e416e18fdfe904a66284b0cf56cf256ec7 (patch) | |
| tree | 78c18e41b683261138f1b6349a34057d145a3ae2 /tests/diagnostics | |
| parent | 57f0ab410766374b155fa546c31812d593480048 (diff) | |
Fix div-by-zero error during sccp. (#2911)
* Diagnose on div-by-zero during sccp.
* fix
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/diagnostics')
| -rw-r--r-- | tests/diagnostics/sccp-div-by-zero.slang | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/diagnostics/sccp-div-by-zero.slang b/tests/diagnostics/sccp-div-by-zero.slang new file mode 100644 index 000000000..b7c85fe10 --- /dev/null +++ b/tests/diagnostics/sccp-div-by-zero.slang @@ -0,0 +1,19 @@ +//TEST:SIMPLE(filecheck=CHECK): -entry computeMain -profile cs_5_0 -target hlsl +RWStructuredBuffer<uint> outputBuffer; + +// CHECK: divide by zero +uint check<let b : bool>() +{ + return 1 / int(b); +} + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + + uint a = check<false>(); + uint b = check<true>(); + + outputBuffer[tid] = a + b; +}
\ No newline at end of file |
