aboutsummaryrefslogtreecommitdiff
path: root/tests/conformance/6-ownership/back_link_cycle.zc
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-15 14:59:31 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-15 14:59:31 +0330
commit8703e2c85a8ecdea9e869e876e347ebd4cb6ef88 (patch)
tree0ca06ae1f09abf9245b1eabf5d74099f829ad6e6 /tests/conformance/6-ownership/back_link_cycle.zc
parentanalyzer: infer .u from returns of fresh objects in the body (prescan guess, ... (diff)
analyzer: a back link (container's owner stored into it) stays a plain reference, fixing a compile hang on a<->b and a leak; ending an owner kills its owned children too (fixes use after reassigning a container); escape fixtures
Diffstat (limited to 'tests/conformance/6-ownership/back_link_cycle.zc')
-rw-r--r--tests/conformance/6-ownership/back_link_cycle.zc17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/conformance/6-ownership/back_link_cycle.zc b/tests/conformance/6-ownership/back_link_cycle.zc
new file mode 100644
index 0000000..fc47100
--- /dev/null
+++ b/tests/conformance/6-ownership/back_link_cycle.zc
@@ -0,0 +1,17 @@
+// expect: 0/
+// spec 6.6
+include rt;
+struct node { int value; node* prev; node* next; };
+fn main() {
+ memdebug on;
+ for (int round = 0; round < 50; round++) {
+ node* a = rt.new(node);
+ node* b = rt.new(node);
+ a.next = b;
+ b.prev = a;
+ a.value = round;
+ b.value = b.prev.value;
+ }
+ rt.put_n(rt.memreport()); rt.put_c(10);
+}
+// zc0: skip