Open mrkn opened 3 years ago
This is valgrind output.
$ valgrind $(rbenv which ruby) test.rb
==2294062== Memcheck, a memory error detector
==2294062== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==2294062== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==2294062== Command: /home/mrkn/.rbenv/versions/3.0.1/bin/ruby test.rb
==2294062==
==2294062== Warning: client switching stacks? SP change: 0x1ffe8020d0 --> 0x1fff000150
==2294062== to suppress, use: --max-stackframe=8380544 or greater
["/usr/lib/x86_64-linux-gnu/libopenblas.so.0", "/usr/lib/x86_64-linux-gnu/liblapacke64.so.3.9.0"]
==2294062== Invalid write of size 8
==2294062== at 0x41BB6B70: dstein_ (in /usr/lib/x86_64-linux-gnu/lapack64/liblapack64.so.3.9.0)
==2294062== by 0x41BC418E: dsyevx_ (in /usr/lib/x86_64-linux-gnu/lapack64/liblapack64.so.3.9.0)
==2294062== by 0x41BC8BDA: dsygvx_ (in /usr/lib/x86_64-linux-gnu/lapack64/liblapack64.so.3.9.0)
==2294062== by 0x19764283: LAPACKE_dsygvx_work (in /usr/lib/x86_64-linux-gnu/liblapacke64.so.3.9.0)
==2294062== by 0x19763DF5: LAPACKE_dsygvx (in /usr/lib/x86_64-linux-gnu/liblapacke64.so.3.9.0)
==2294062== by 0xAD5A5BE: iter_lapack_s_dsygvx (sygvx.c:42)
==2294062== by 0xA7C1257: loop_narray (ndloop.c:1336)
==2294062== by 0xA7C2440: ndloop_run (ndloop.c:1297)
==2294062== by 0x492799D: rb_ensure (eval.c:1162)
==2294062== by 0xA7C5818: na_ndloop_main (ndloop.c:1409)
==2294062== by 0xA7C5C08: na_ndloop3 (ndloop.c:1476)
==2294062== by 0xAD63E74: lapack_s_dsygvx (sygvx.c:187)
==2294062== Address 0x9c662e8 is 0 bytes after a block of size 8 alloc'd
==2294062== at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==2294062== by 0x494D43F: objspace_xmalloc0 (gc.c:10618)
==2294062== by 0x494D43F: ruby_xmalloc0 (gc.c:10839)
==2294062== by 0x494D43F: ruby_xmalloc_body (gc.c:10848)
==2294062== by 0x494D43F: ruby_xmalloc (gc.c:12787)
==2294062== by 0xA807B28: int32_allocate (allocate.c:13)
==2294062== by 0x4B0F7D6: vm_call0_cfunc_with_frame (vm_eval.c:135)
==2294062== by 0x4B0F7D6: vm_call0_cfunc (vm_eval.c:149)
==2294062== by 0x4B0F7D6: vm_call0_body (vm_eval.c:180)
==2294062== by 0x4B12C6F: vm_call0_cc (vm_eval.c:72)
==2294062== by 0x4B12C6F: rb_funcallv_scope (vm_eval.c:1006)
==2294062== by 0x4B12C6F: rb_funcallv (vm_eval.c:1026)
==2294062== by 0xA7B6A92: na_get_pointer_for_rw (narray.c:714)
==2294062== by 0xA7B6A92: nary_get_pointer_for_write (narray.c:756)
==2294062== by 0xA7C03D4: ndloop_set_stepidx.isra.0 (ndloop.c:523)
==2294062== by 0xA7C15C9: ndloop_set_output_narray (ndloop.c:794)
==2294062== by 0xA7C2093: ndloop_set_output (ndloop.c:821)
==2294062== by 0xA7C2093: ndloop_run (ndloop.c:1267)
==2294062== by 0x492799D: rb_ensure (eval.c:1162)
==2294062== by 0xA7C5818: na_ndloop_main (ndloop.c:1409)
==2294062== by 0xA7C5C08: na_ndloop3 (ndloop.c:1476)
==2294062==
*** stack smashing detected ***: terminated
==2294062==
==2294062== Process terminating with default action of signal 6 (SIGABRT): dumping core
==2294062== at 0x4CAE18B: raise (raise.c:51)
==2294062== by 0x4C8D858: abort (abort.c:79)
==2294062== by 0x4CF83ED: __libc_message (libc_fatal.c:155)
==2294062== by 0x4D9AB49: __fortify_fail (fortify_fail.c:26)
==2294062== by 0x4D9AB15: __stack_chk_fail (stack_chk_fail.c:24)
==2294062== by 0xAD5A5FD: iter_lapack_s_dsygvx (sygvx.c:46)
==2294062== by 0xA7C1257: loop_narray (ndloop.c:1336)
==2294062== by 0xA7C2440: ndloop_run (ndloop.c:1297)
==2294062== by 0x492799D: rb_ensure (eval.c:1162)
==2294062== by 0xA7C5818: na_ndloop_main (ndloop.c:1409)
==2294062== by 0xA7C5C08: na_ndloop3 (ndloop.c:1476)
==2294062== by 0xAD63E74: lapack_s_dsygvx (sygvx.c:187)
==2294062==
==2294062== HEAP SUMMARY:
==2294062== in use at exit: 51,316,903 bytes in 101,992 blocks
==2294062== total heap usage: 586,260 allocs, 484,268 frees, 141,784,088 bytes allocated
==2294062==
==2294062== LEAK SUMMARY:
==2294062== definitely lost: 1,728 bytes in 36 blocks
==2294062== indirectly lost: 2,607 bytes in 47 blocks
==2294062== possibly lost: 14,892,379 bytes in 92,848 blocks
==2294062== still reachable: 36,420,189 bytes in 9,061 blocks
==2294062== suppressed: 0 bytes in 0 blocks
==2294062== Rerun with --leak-check=full to see details of leaked memory
==2294062==
==2294062== For lists of detected and suppressed errors, rerun with: -s
==2294062== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Aborted (core dumped)
I used this test script.
First, I confirmed that the problem occurs with liblapacke64.
Then, I tried the same test script with liblapacke.
The problem does not occur with liblapacke.