I'm trying to port a library and hitting a problem in the GC. I'm not sure I
can reduce it to a small program which exhibits the problem. The key bits are:
$ nim --version
Nim Compiler Version 0.19.0 [Linux: amd64]
Compiled at 2018-09-26
Copyright (c) 2006-2018 by Andreas Rumpf
git hash: f6c5c636bb1a1f4e1301ae0ba5a8afecef439132
active boot switches: -d:release
$ nimble test
...
Traceback (most recent call last)
test1.nim(31) test1
config.nim(448) failingProc
gc.nim(493) newObjRC1
gc.nim(185) decRef
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Run
The lines in config.nim in `failingProc` where it happens are
447 var s = $text
448 result.text = s
Run
and these lines have been executed many times through successive calls to
`failingProc` from the test. The `text` variable is initialised at the top of
`failingProc` using
var text : seq[Rune] = @[]
Run
and the intervening lines just add some runes to it before the failing line. If
I add various `echo` lines, the location of the failure above the GC call moves
around (e.g. to `system.nim(216)`). There's nothing special about N where it
fails on the N th call to `failingProc` \- with extra `echo` lines, it fails at
a different time during processing with those lines in gc.nim.
Any ideas on how best to debug this type of situation? Are there known issues
with GC on 0.19.0 which have been fixed since it was released?