summaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2021-04-19 12:13:35 -0400
committerGitHub <noreply@github.com>2021-04-19 09:13:35 -0700
commit22b562d1a47443f266b114b4b207bcdd4eb3c54f (patch)
tree48dc9675bff696296b3b51cc012636f976c1f313 /tests/bugs
parent2886bc35e7b023370a8b8d56d78e5335eee2eb98 (diff)
Infinite generic parsing bug fix (#1799)
* #include an absolute path didn't work - because paths were taken to always be relative. * Fix bug causing infinite loop in parser. * Add a faster path for LookAheadToken when the offset is 0. * Fix typo introduced in last commit.
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/eroneous-generic-parse.slang15
-rw-r--r--tests/bugs/eroneous-generic-parse.slang.expected8
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/bugs/eroneous-generic-parse.slang b/tests/bugs/eroneous-generic-parse.slang
new file mode 100644
index 000000000..80a693456
--- /dev/null
+++ b/tests/bugs/eroneous-generic-parse.slang
@@ -0,0 +1,15 @@
+//DIAGNOSTIC_TEST:SIMPLE: -target hlsl -entry computeMain -stage compute
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=16):out
+RWStructuredBuffer<int> outputBuffer;
+
+// Previously this definition would lead to an infinite loop in parsing.
+int doThing<1>() { return 2; }
+
+[numthreads(4, 4, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int index = dispatchThreadID.x;
+
+ outputBuffer[index] = index;
+} \ No newline at end of file
diff --git a/tests/bugs/eroneous-generic-parse.slang.expected b/tests/bugs/eroneous-generic-parse.slang.expected
new file mode 100644
index 000000000..a6ee73d88
--- /dev/null
+++ b/tests/bugs/eroneous-generic-parse.slang.expected
@@ -0,0 +1,8 @@
+result code = -1
+standard error = {
+tests/bugs/eroneous-generic-parse.slang(7): error 20001: unexpected integer literal, expected identifier
+int doThing<1>() { return 2; }
+ ^
+}
+standard output = {
+}