nmatrix
nmatrix copied to clipboard
Segfault when creating :object NMatrix with nils
I tried to create a dtype: :object NMatrix object with nils and it randomly segfaults sometimes,or sometimes does not.
Try this code to test:
100000.times { a = NMatrix.new [5], [1,2,nil,nil,nil], dtype: :object}
Sometimes it segfaults, other times its fine.
Can you compile in debug mode and get a backtrace?
I've never done that before.
Could you please guide me?
Yeah. In the extconf.rb file, you want to change -O3 to -O0 and add -g in the C and C++ flags. rake clean then rake compile, then rake spec:gdb
Probably related to #126, #139, #200, #277.
If it is related to those, using -O0 instead of -O3 will probably change whether the bug occurs, so it might be worth debugging both ways, even though it will be harder with -O3 on...