diff options
| author | Tim Foley <tfoley@nvidia.com> | 2017-07-11 15:43:18 -0700 |
|---|---|---|
| committer | Tim Foley <tfoley@nvidia.com> | 2017-07-11 15:43:18 -0700 |
| commit | 24a44ffdd6e5648b3e0528ac3ccc871da853158c (patch) | |
| tree | 915b5124f0da1eed6b85f1616178e80a0dfbe3af /tests | |
| parent | d8d8fefb9693e83bea215629f3a77f8a48d2f50f (diff) | |
Make parser recovering more robust to avoid infinite loops
Fixes #75
In order to avoid cascaded errors, I went ahead and made the parser refuse to skip past a `}` in recovery mode. The problem with this is that we fail to make forward progress if we are stuck on a `}` (this happens if you have an extra `}` at the global scope.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bugs/gh-75.hlsl | 24 | ||||
| -rw-r--r-- | tests/bugs/gh-75.hlsl.expected | 6 |
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/bugs/gh-75.hlsl b/tests/bugs/gh-75.hlsl new file mode 100644 index 000000000..fbaaf6a73 --- /dev/null +++ b/tests/bugs/gh-75.hlsl @@ -0,0 +1,24 @@ +//TEST:SIMPLE:-profile cs_5_0 + +// Missing opening `{` sends parser into infinite loop + +struct LightCB +{ + float3 vec3Val; // We're using 2 values. [0]: worldDir [1]: intensity +}; + +StructuredBuffer<LightCB> gLightIn; +AppendStructuredBuffer<LightCB> gLightOut; + +[numthreads(1, 1, 1)] +void main() +{ + uint numLights = 0; + uint stride; + gLightIn.GetDimensions(numLights, stride); + + for (uint i = 0; i < numLights; i++) + + gLightOut.Append(gLightIn[i]); + } +}
\ No newline at end of file diff --git a/tests/bugs/gh-75.hlsl.expected b/tests/bugs/gh-75.hlsl.expected new file mode 100644 index 000000000..345acd804 --- /dev/null +++ b/tests/bugs/gh-75.hlsl.expected @@ -0,0 +1,6 @@ +result code = -1 +standard error = { +tests/bugs/gh-75.hlsl(24): error 20001: unexpected '}', expected identifier +} +standard output = { +} |
