Skip to content

--gc:arc SIGSEGV (double free?) #13119

Closed
Closed
@napalu

Description

@napalu

The following code provokes a SIGSEV when compiled with --gc:arc

Example test_arc.nim

import streams

var m = newStringStream("Hello world")
let buffer = m.readStr(5)
echo buffer
m.close

Current Output using nim c -d:debug --gc:arc -d:traceArc

[Allocated] 0x7fa600b6a048
[Freed] 0x7fa600b6a048
Hello
[Freed] 0x7fa600b6a048
Traceback (most recent call last)
/data/Projects/nimdex/test_arc.nim(6) test_arc
/data/Projects/Nim/lib/pure/streams.nim(178) close
/data/Projects/Nim/lib/pure/streams.nim(1100) ssClose
/data/Projects/Nim/lib/system/refs_v2.nim(124) nimDestroyAndDispose
/data/Projects/Nim/lib/system/refs_v2.nim(101) nimRawDispose
/data/Projects/Nim/lib/system/alloc.nim(945) dealloc
/data/Projects/Nim/lib/system/alloc.nim(860) rawDealloc
/data/Projects/Nim/lib/system/avltree.nim(74) del
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
$ nim -v
Nim Compiler Version 1.1.1 [Linux: amd64]
Compiled at 2020-01-12
Copyright (c) 2006-2019 by Andreas Rumpf

git hash: 01a89cc473c7b98a92c6c6f9c17d294829d3858d
active boot switches: -d:release

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions