Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Owned ref can be copied and causes double-free #11617

alaviss opened this issue Jun 29, 2019 · 0 comments


Copy link

commented Jun 29, 2019


  a = RootRef()
  b = a

echo a[]
echo b[]
echo typeof(a)
echo typeof(b)

Current Output

owned RootRef
owned RootRef
Traceback (most recent call last)
test.nim(2)              test
runtime_v2.nim(91)       nimDestroyAndDispose
runtime_v2.nim(71)       nimRawDispose
alloc.nim(945)           dealloc
alloc.nim(860)           rawDealloc
avltree.nim(74)          del
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

Expected Output

owned RootRef

Additional Information

$ nim -v
Nim Compiler Version 0.20.99 [Linux: amd64]
Compiled at 2019-06-29
Copyright (c) 2006-2019 by Andreas Rumpf

git hash: 3606e035f5f4d688876a83f824f7e7b3ac4ff083
active boot switches: -d:release -d:useLinenoise -d:nativeStackTrace

@alaviss alaviss changed the title Owned ref can be copied Owned ref can be copied and causes double-free Jun 29, 2019

@Araq Araq closed this in bd55c86 Jul 1, 2019

narimiran added a commit that referenced this issue Jul 2, 2019

fixes #11617
(cherry picked from commit bd55c86)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.