Invalid memory access in Y12 sparse solver
Dear MBDyn developers,
If I build the current 'develop' branch (commit cf94c45c) of MBDyn and run the following command in the folder libraries/libmbwrap
valgrind ./wraptest -m y12
I get the following output:
==35534== Memcheck, a memory error detector
==35534== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==35534== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==35534== Command: ./wraptest -m y12
==35534==
y12 solver
1 0 0
0 2 -1
10 11 3
==35534== Invalid read of size 4
==35534== at 0x1AAD37: y12mcf_ (y12mcf.f:190)
==35534== by 0x1719B7: Y12Solver::Factor() (y12wrap.cc:203)
==35534== by 0x171C41: Y12Solver::Solve() const (y12wrap.cc:234)
==35534== by 0x17438B: Y12SparseSolutionManager::Solve() (y12wrap.cc:642)
==35534== by 0x15035E: main (wraptest.cc:927)
==35534== Address 0x9ccfedc is 4 bytes before a block of size 108 alloc'd
==35534== at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==35534== by 0x158F05: __gnu_cxx::new_allocator<int>::allocate(unsigned long, void const*) (new_allocator.h:114)
==35534== by 0x158470: std::allocator_traits<std::allocator<int> >::allocate(std::allocator<int>&, unsigned long) (alloc_traits.h:444)
==35534== by 0x15711B: std::_Vector_base<int, std::allocator<int> >::_M_allocate(unsigned long) (stl_vector.h:343)
==35534== by 0x174ACA: std::vector<int, std::allocator<int> >::reserve(unsigned long) (vector.tcc:78)
==35534== by 0x174035: Y12SparseSolutionManager::Y12SparseSolutionManager(int, int, double const&, bool) (y12wrap.cc:554)
==35534== by 0x14F843: main (wraptest.cc:712)
==35534==
==35534== Invalid write of size 4
==35534== at 0x1AAD3F: y12mcf_ (y12mcf.f:191)
==35534== by 0x1719B7: Y12Solver::Factor() (y12wrap.cc:203)
==35534== by 0x171C41: Y12Solver::Solve() const (y12wrap.cc:234)
==35534== by 0x17438B: Y12SparseSolutionManager::Solve() (y12wrap.cc:642)
==35534== by 0x15035E: main (wraptest.cc:927)
==35534== Address 0x9ccfedc is 4 bytes before a block of size 108 alloc'd
==35534== at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==35534== by 0x158F05: __gnu_cxx::new_allocator<int>::allocate(unsigned long, void const*) (new_allocator.h:114)
==35534== by 0x158470: std::allocator_traits<std::allocator<int> >::allocate(std::allocator<int>&, unsigned long) (alloc_traits.h:444)
==35534== by 0x15711B: std::_Vector_base<int, std::allocator<int> >::_M_allocate(unsigned long) (stl_vector.h:343)
==35534== by 0x174ACA: std::vector<int, std::allocator<int> >::reserve(unsigned long) (vector.tcc:78)
==35534== by 0x174035: Y12SparseSolutionManager::Y12SparseSolutionManager(int, int, double const&, bool) (y12wrap.cc:554)
==35534== by 0x14F843: main (wraptest.cc:712)
==35534==
==35534== Conditional jump or move depends on uninitialised value(s)
==35534== at 0x1AAD2C: y12mcf_ (y12mcf.f:189)
==35534== by 0x1719B7: Y12Solver::Factor() (y12wrap.cc:203)
==35534== by 0x171C41: Y12Solver::Solve() const (y12wrap.cc:234)
==35534== by 0x17438B: Y12SparseSolutionManager::Solve() (y12wrap.cc:642)
==35534== by 0x15035E: main (wraptest.cc:927)
==35534==
==35534== Invalid read of size 4
==35534== at 0x1AAD27: y12mcf_ (y12mcf.f:189)
==35534== by 0x1719B7: Y12Solver::Factor() (y12wrap.cc:203)
==35534== by 0x171C41: Y12Solver::Solve() const (y12wrap.cc:234)
==35534== by 0x17438B: Y12SparseSolutionManager::Solve() (y12wrap.cc:642)
==35534== by 0x15035E: main (wraptest.cc:927)
==35534== Address 0x9ccff4c is 0 bytes after a block of size 108 alloc'd
==35534== at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==35534== by 0x158F05: __gnu_cxx::new_allocator<int>::allocate(unsigned long, void const*) (new_allocator.h:114)
==35534== by 0x158470: std::allocator_traits<std::allocator<int> >::allocate(std::allocator<int>&, unsigned long) (alloc_traits.h:444)
==35534== by 0x15711B: std::_Vector_base<int, std::allocator<int> >::_M_allocate(unsigned long) (stl_vector.h:343)
==35534== by 0x174ACA: std::vector<int, std::allocator<int> >::reserve(unsigned long) (vector.tcc:78)
==35534== by 0x174035: Y12SparseSolutionManager::Y12SparseSolutionManager(int, int, double const&, bool) (y12wrap.cc:554)
==35534== by 0x14F843: main (wraptest.cc:712)
==35534==
Y12Solver (y12factor): error during factorization, code 8:
A column without non-zero elements in its
active part is found during the
decomposition. If the drop-tolerance,
AFLAG(2), is sufficiently small, then
IFAIL = 8 indicates that the matrix is
numerically singular. If a large value of
the drop-tolerance AFLAG(2) is used and if
IFAIL = 8 on exit, this is not certain. A
run with a smaller value of AFLAG(2)
and/or a careful check of the parameters
AFLAG(8) and AFLAG(5) is recommended in
the latter case.
wraptest: an exception occured ([/home/reinhard/work/mbdyn-git/libraries/libmbwrap/y12wrap.cc:215,func=void Y12Solver::Factor()])
It seems, that Y12 is broken on the 'develop' branch. On the master branch, y12 still works.