summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorcooldome <cdome@bk.ru>2020-05-11 18:10:54 +0100
committerGitHub <noreply@github.com>2020-05-11 19:10:54 +0200
commitfee71d466cdb7cda96b55592abbf7d433639ab51 (patch)
tree201ffd746d8ff54e87f94d77dfa246dffd05d27d /compiler
parent03c146cd93ba48f7e8cab05e6214c8675d0dd1f9 (diff)
downloadNim-fee71d466cdb7cda96b55592abbf7d433639ab51.tar.gz
fix #14294 (#14301)
* fix #14294

* fix orc as well

Co-authored-by: cooldome <ariabushenko@bk.ru>
Diffstat (limited to 'compiler')
-rw-r--r--compiler/liftdestructors.nim7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/liftdestructors.nim b/compiler/liftdestructors.nim
index 6f4e5828d..d70b968a8 100644
--- a/compiler/liftdestructors.nim
+++ b/compiler/liftdestructors.nim
@@ -448,7 +448,8 @@ proc useSeqOrStrOp(c: var TLiftCtx; t: PType; body, x, y: PNode) =
 
   case c.kind
   of attachedAsgn, attachedDeepCopy:
-    doAssert t.assignment != nil
+    if t.assignment == nil:
+      return # protect from recursion
     body.add newHookCall(c.g, t.assignment, x, y)
   of attachedSink:
     # we always inline the move for better performance:
@@ -465,8 +466,12 @@ proc useSeqOrStrOp(c: var TLiftCtx; t: PType; body, x, y: PNode) =
     doAssert t.destructor != nil
     body.add destructorCall(c, t.destructor, x)
   of attachedTrace:
+    if t.attachedOps[c.kind] == nil:
+      return # protect from recursion
     body.add newHookCall(c.g, t.attachedOps[c.kind], x, y)
   of attachedDispose:
+    if t.attachedOps[c.kind] == nil:
+      return # protect from recursion
     body.add newHookCall(c.g, t.attachedOps[c.kind], x, nil)
 
 proc fillStrOp(c: var TLiftCtx; t: PType; body, x, y: PNode) =