<div dir="ltr">Hello,<div><br></div><div>I call TaosSolve() in my code. The solution vector is a nested and Jacobian matrix is nested too. It shows me the error:</div><div><br></div><div><div>[0]PETSC ERROR: ------------------------------------------------------------------------</div>
<div>[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range</div><div>[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger</div><div>[0]PETSC ERROR: or see <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind[0]PETSC">http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind[0]PETSC</a> ERROR: or try <a href="http://valgrind.org">http://valgrind.org</a> on GNU/linux and Apple Mac OS X to find memory corruption errors</div>
<div>[1]PETSC ERROR: [0]PETSC ERROR: likely location of problem given in stack below</div><div>[0]PETSC ERROR: ---------------------  Stack Frames ------------------------------------</div><div>[0]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,</div>
<div>[0]PETSC ERROR:       INSTEAD the line number of the start of the function</div><div>[0]PETSC ERROR:       is given.</div><div>[0]PETSC ERROR: [0] VecRestoreArray_Nest line 731 /home/khp/bin/petsc-3.5.1/src/vec/vec/impls/nest/vecnest.c</div>
<div>[0]PETSC ERROR: [0] VecRestoreArray line 1656 /home/khp/bin/petsc-3.5.1/src/vec/vec/interface/rvector.c</div><div>[0]PETSC ERROR: [0] VecMedian line 806 /home/khp/bin/petsc-3.5.1/src/vec/vec/utils/projection.c</div><div>
[0]PETSC ERROR: [0] TaoSolve_SSILS line 52 /home/khp/bin/petsc-3.5.1/src/tao/complementarity/impls/ssls/ssils.c</div><div>[0]PETSC ERROR: [0] TaoSolve line 171 /home/khp/bin/petsc-3.5.1/src/tao/interface/taosolver.c</div>
</div><div><br></div><div>I debugged with valgrind and received the following message:</div><div><br></div><div><div>==19424== Invalid read of size 8</div><div>==19424==    at 0x54089E4: VecRestoreArray_Nest (vecnest.c:746)</div>
<div>==19424==    by 0x53F5F6F: VecRestoreArray (rvector.c:1666)</div><div>==19424==    by 0x54BE874: VecMedian (projection.c:855)</div><div>==19424==    by 0x6247B74: TaoSolve_SSILS (ssils.c:59)</div><div>==19424==    by 0x620739E: TaoSolve (taosolver.c:188)</div>
<div>==19424==    by 0x40491C: main (main.cpp:265)</div><div>==19424==  Address 0x0 is not stack'd, malloc'd or (recently) free'd</div></div><div><br></div><div>It looks like the bug relates to the nested vector. Could you please give me a hint to locate the bug? Thanks.</div>
<div><br></div><div>Khai</div></div>