summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-11-15 15:47:42 +0100
committerGitHub <noreply@github.com>2020-11-15 15:47:42 +0100
commit7eb34d170a489c2a0ed90d921f3f7cc6813f19c1 (patch)
tree88fbcfdc45f6d75eb888fa3048582ccc683b0ab6 /tests
parent92da06e64ece2f87e259c17439c085074d77ef97 (diff)
downloadNim-7eb34d170a489c2a0ed90d921f3f7cc6813f19c1.tar.gz
fixes #15753 [backport:1.4] (#15971)
Diffstat (limited to 'tests')
-rw-r--r--tests/arc/torc_selfcycles.nim33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/arc/torc_selfcycles.nim b/tests/arc/torc_selfcycles.nim
new file mode 100644
index 000000000..ac4fa52ce
--- /dev/null
+++ b/tests/arc/torc_selfcycles.nim
@@ -0,0 +1,33 @@
+discard """
+  output: '''ok'''
+  cmd: '''nim c --gc:orc -d:useMalloc -d:nimStressOrc $file'''
+  valgrind: "leaks"
+"""
+
+# bug #15753
+
+type
+  NodeKind = enum
+    nkDancing,
+    nkColumn
+
+  DancingNode = ref object
+    right: DancingNode
+    column: DancingNode
+    kind: NodeKind
+
+proc newColumnNode(): DancingNode =
+  result = DancingNode(kind: nkColumn)
+  result.right = result
+  result.column = result
+
+proc createDLXList(): DancingNode =
+  result = newColumnNode()
+
+  for i in 0 .. 15:
+    let n = newColumnNode()
+    n.right = result.right
+    result = n
+  echo "ok"
+
+var dlxlist = createDLXList()