nmatrix icon indicating copy to clipboard operation
nmatrix copied to clipboard

Segfault when creating :object NMatrix with nils

Open v0dro opened this issue 10 years ago • 5 comments

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.

v0dro avatar Dec 11 '14 08:12 v0dro

Can you compile in debug mode and get a backtrace?

translunar avatar Dec 11 '14 16:12 translunar

I've never done that before.

Could you please guide me?

v0dro avatar Dec 11 '14 17:12 v0dro

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

translunar avatar Dec 11 '14 17:12 translunar

Probably related to #126, #139, #200, #277.

translunar avatar Mar 11 '15 19:03 translunar

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...

cjfuller avatar Mar 11 '15 20:03 cjfuller