<div dir="ltr">Hello,<div><br></div><div>I'm trying to use NTL in thread-safe mode, but it doesn't seem to work right. I build NTL with the following options:</div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">./configure CXXFLAGS="-g -O2 -pthread --std=c++11 -fPIC" NTL_THREADS=on NTL_GF2X_LIB=on<br>make</blockquote><div> <br></div></div><div>Then I run "make check" and the ThreadTest hangs. Backtrace gives me the following:</div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">#0  0x00007ffff7ad7012 in wait () from /lib64/libc.so.6<br>#1  0x00000000004105f8 in reap_children ()<br>#2  0x0000000000411344 in new_job ()<br>#3  0x000000000041a868 in update_file ()<br>#4  0x000000000041ae20 in update_goal_chain ()<br>#5  0x0000000000403c9f in main ()</blockquote><div><br></div><div>It seems like there's a deadlock somewhere.</div><div>Futhermore, if i still try to use NTL's PowerXMod() function with GF2X, I get a segfault with a strange backtrace:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">trunc: bad args<br>trunc: bad args<br>Program received signal SIGSEGV, Segmentation fault.<br>[Switching to Thread 0x7fffe68d3700 (LWP 12615)]<br>NTL::GF2X::normalize (this=this@entry=0x7ffff0190ca0 <NTL::NewtonInvTrunc(NTL::GF2X&, NTL::GF2X const&, long)::g0>)<br>    at GF2X.c:77<br>77<span class="" style="white-space:pre">     </span>   while (n > 0 && (*--p) == 0) {<br>(gdb) bt<br>#0  NTL::GF2X::normalize (<br>    this=this@entry=0x7ffff0190ca0 <NTL::NewtonInvTrunc(NTL::GF2X&, NTL::GF2X const&, long)::g0>) at GF2X.c:77<br>#1  0x00007fffefefabf7 in NTL::trunc (x=..., a=..., m=<optimized out>) at GF2X.c:1557<br>#2  0x00007fffeff057c1 in NTL::NewtonInvTrunc (c=..., a=..., e=5, e@entry=19936) at GF2X1.c:316<br>#3  0x00007fffeff05b6d in NTL::InvTrunc (c=..., a=..., e=e@entry=19936) at GF2X1.c:345<br>#4  0x00007fffeff06550 in NTL::build (F=..., f=...) at GF2X1.c:542<br>#5  0x00007fffeff069d0 in NTL::GF2XModulus::GF2XModulus (this=0x7fffe68d2dc0, ff=...) at GF2X1.c:647<br>#6  0x00007fffefef5b7c in MyClass::my_method (this=this@entry=0x7ffff0190900 <mr>, state=0x702f40, index=<optimized out>) at me_class.cpp:437<br></blockquote><div><br></div><div>The last line here indicates a call to PowerXMod().</div><div>What could be the issue here?</div><div>Thank you in advance.</div><div><br></div><div>Best regards,</div><div>Dmitry</div><div> <br></div></div><div><br></div><div><br></div></div>