SIGSEGV: Illegal storage access.

2020-03-21 Thread mantielero
This is the second time I face this error: SIGSEGV: Illegal storage access. (Attempt to read from nil?) So I am pretty sure this is something that I systematically do wrong. This happens when I wrap some libraries. My question is what is the right strategy to debug this sort of

Re: SIGSEGV: Illegal storage access.

2020-03-22 Thread Araq
* When you wrap C code, use c2nim. * Use `.cdecl` as the calling convention, `.bycopy` for object/struct wrapping. * Use `cint` instead of `int` and in general the right types, especially types of the right size for binary compatibility. * On Linux/OSX you can run your program through `va

Re: SIGSEGV: Illegal storage access.

2020-03-22 Thread mantielero
(Just for the record; I haven't checked if these are already known issues or if they are actually issues or my misuse) I am playing again with c2nim. I am not sure if this could be a problem: typedef enum VSColorFamily { cmGray = 100, cmRGB= 200 } V

Re: SIGSEGV: Illegal storage access.

2020-03-22 Thread mantielero
Thanks @Araq, that helped me fix the bug.

SIGSEGV: Illegal storage access. (Attempt to read from nil?) 3

2018-02-25 Thread nimboolean
(most recent call last) rewrite.nim(26) rewrite strtabs.nim(133) getOrDefault strtabs.nim(104) rawGet strtabs.nim(85) myhash SIGSEGV: Illegal storage access. (Attempt to read from nil?)

SIGSEGV: Illegal storage access. (Attempt to read from nil?) 2

2019-05-08 Thread blmvxer
I know this is old, but initializing all seq[] with a dummy variable then wiping them before their intended use seems to work for me.

Re: SIGSEGV: Illegal storage access. (Attempt to read from nil?) 3

2018-02-25 Thread StasB
It looks like the second argument to getOrDefault is supposed to be a non-nil string.

Re: SIGSEGV: Illegal storage access. (Attempt to read from nil?) 3

2018-02-25 Thread nimboolean
ISSUE RESOLVED. I fixed the error by checking for attrsLen property like this: import htmlparser import xmltree import strtabs import strutils let allhtml:File = open("allhtml.txt") var line: string var count = 0 while allhtml.readline(line):

Re: SIGSEGV: Illegal storage access. (Attempt to read from nil?) 3

2018-02-25 Thread nimboolean
nope. it did not make any difference. import htmlparser import xmltree import strtabs import strutils let allhtml:File = open("allhtml.txt") var line: string var count = 0 while allhtml.readline(line): echo "HTML file: ", count, line v

Re: SIGSEGV: Illegal storage access. (Attempt to read from nil?) 2

2019-05-08 Thread treeform
In the new nim 19.0, nil and seq of length 0 are the same. So you should not run into this as often. These are now all valid and work: var a: seq[int] a.add 1 var b = newSeq[int]() b.add 1 var c: seq[int] = @[] c.add 1 Run initializing al

no "--opt:size" leads EXE to "SIGSEGV: Illegal storage access. (Attempt to read from nil?)"

2019-01-30 Thread oyster
example2.nim| the EXE runs and crash all the crashes says SIGSEGV: Illegal storage access. (Attempt to read from nil?) Error: execution of an external program failed: 'C:\Users\USER\.nimble\pkgs\wxnim-0.8.0\examples\purewx\example2.exe ' Run of cause,

Re: no "--opt:size" leads EXE to "SIGSEGV: Illegal storage access. (Attempt to read from nil?)"

2019-01-30 Thread Araq
Compile without -d:release and with `-d:useSysAssert -d:useGcAssert`, you have a memory corruption, most likely because of a bug in your wrapping code. Don't assume that it's "only" \--opt:size that makes your program crash, you are simply "lucky" for the other optimization levels.

Re: no "--opt:size" leads EXE to "SIGSEGV: Illegal storage access. (Attempt to read from nil?)"

2019-01-30 Thread oyster
.nim Run says Traceback (most recent call last) example2.nim(7) example2 example2.nim(40) createFrame SIGSEGV: Illegal storage access. (Attempt to read from nil?) Run where line 07 let f = createFrame

Re: no "--opt:size" leads EXE to "SIGSEGV: Illegal storage access. (Attempt to read from nil?)"

2019-02-01 Thread timothee
this helped me before: import segfaults it inserts a signal handler and outputs a stacktrace.

Re: no "--opt:size" leads EXE to "SIGSEGV: Illegal storage access. (Attempt to read from nil?)"

2019-02-02 Thread lemonboy
First things first, I'm able to run your program without `--opt:size` after some minor modifications. You're building a `wxListItem` incorrectly since you specify too few masks and the width and format you specify are ignored: see [here](https://github.com/wxWidgets/wxWidgets/blob/cc931612eec2e