qpDUNES / qpDUNES-dev

Private development repository for qpDUNES
GNU Lesser General Public License v3.0
4 stars 6 forks source link

SEGFAULT in example3_affine_mpc #3

Open mkatliar opened 9 years ago

mkatliar commented 9 years ago

To reproduce: run example3_affine_mpc

Unhandled exception at 0x000000013F9CB4A4 in example3_affine_mpc.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

Happens in setup_mpc.c, line 729:

*qpObjConst = 0.;

Call stack:

>   example3_affine_mpc.exe!mpcDUNES_initLtv(mpcProblem_t * const mpcProblem, const double * const H_, const double * const g_, const double * const C_, const double * const c_, const double * const zLow_, const double * const zUpp_, const double * const D_, const double * const dLow_, const double * const dUpp_, const double * const zRef_) Line 729 C
    example3_affine_mpc.exe!main() Line 247 C++

qpObjConst is initialized to mpcProblem->qpObjConst in line 660, but mpcProblem->qpObjConst contains an unitialized value:

mpcProblem->qpObjConst = 0xcccccccccccccccc {???}
mvukov commented 9 years ago

Well, this is an older issue. Maybe you can paste valgrind output...

mvukov commented 9 years ago

Here's output of lldb on OS X:

qpDUNES -- A DUal NEwton Strategy for convex quadratic programming.
Copyright (C) 2012-2014 by Janick Frasch and Hans Joachim Ferreau.
Developed within the Optimization in Engineering Center (OPTEC) at
KU Leuven, Belgium under supervision of Moritz Diehl. All rights
reserved.

qpDUNES is distributed under the terms of the GNU Lesser
General Public License 3 in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

Process 3111 stopped
* thread #1: tid = 0x313ad, 0x0000000100021a8b example3_affine_mpc`mpcDUNES_initLtv(mpcProblem=0x00007fff5fbff098, H_=0x00000001000605c0, g_=<unavailable>, C_=0x00000001000606c0, c_=0x0000000100060750, zLow_=0x0000000100060780, zUpp_=<unavailable>, D_=<unavailable>, dLow_=<unavailable>, dUpp_=<unavailable>, zRef_=0x00000001000608e0) + 2923 at setup_mpc.c:729, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000100021a8b example3_affine_mpc`mpcDUNES_initLtv(mpcProblem=0x00007fff5fbff098, H_=0x00000001000605c0, g_=<unavailable>, C_=0x00000001000606c0, c_=0x0000000100060750, zLow_=0x0000000100060780, zUpp_=<unavailable>, D_=<unavailable>, dLow_=<unavailable>, dUpp_=<unavailable>, zRef_=0x00000001000608e0) + 2923 at setup_mpc.c:729
   726          }
   727      }
   728      /* set constant QP part */
-> 729      *qpObjConst = 0.;
   730      if (zRef_ != 0) {
   731          for ( ii=0; ii<nVttl; ++ii )   *qpObjConst += tmp_HzRef[ii] * zRef_[ii];
   732
mkatliar commented 9 years ago

Here is the valgrind output:

==26416== Memcheck, a memory error detector
==26416== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==26416== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==26416== Command: bin/example3_affine_mpc
==26416== Parent PID: 2095
==26416== 
==26416== Invalid write of size 8
==26416==    at 0x4178F4: mpcDUNES_initLtv (setup_mpc.c:701)
==26416==    by 0x40DE7C: main (example3_affine_mpc.c:247)
==26416==  Address 0x5a5e478 is 0 bytes after a block of size 88 alloc'd
==26416==    at 0x4C2DC90: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==26416==    by 0x413BA4: mpcDUNES_setup (setup_mpc.c:69)
==26416==    by 0x40DE31: main (example3_affine_mpc.c:233)
==26416== 
==26416== Invalid write of size 8
==26416==    at 0x41791A: mpcDUNES_initLtv (setup_mpc.c:704)
==26416==    by 0x40DE7C: main (example3_affine_mpc.c:247)
==26416==  Address 0x5a5e478 is 0 bytes after a block of size 88 alloc'd
==26416==    at 0x4C2DC90: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==26416==    by 0x413BA4: mpcDUNES_setup (setup_mpc.c:69)
==26416==    by 0x40DE31: main (example3_affine_mpc.c:233)
==26416== 
==26416== Use of uninitialised value of size 8
==26416==    at 0x417F2A: mpcDUNES_initLtv (setup_mpc.c:729)
==26416==    by 0x40DE7C: main (example3_affine_mpc.c:247)
==26416== 
==26416== Use of uninitialised value of size 8
==26416==    at 0x417A43: mpcDUNES_initLtv (setup_mpc.c:731)
==26416==    by 0x40DE7C: main (example3_affine_mpc.c:247)
==26416== 
==26416== Conditional jump or move depends on uninitialised value(s)
==26416==    at 0x43564D: qpOASES::QProblemB::backsolveR(double const*, qpOASES::BooleanType, qpOASES::BooleanType, double*) const (in /media/sf_E_DRIVE/software/qpDUNES-dev/build/linux/bin/example3_affine_mpc)
==26416==    by 0x420AB3: qpOASES::QProblem::determineStepDirection(double const*, double const*, double const*, double const*, double const*, qpOASES::BooleanType, qpOASES::BooleanType, double*, double*, double*, double*) (in /media/sf_E_DRIVE/software/qpDUNES-dev/build/linux/bin/example3_affine_mpc)
==26416==    by 0x42EA04: qpOASES::QProblem::solveQP(double const*, double const*, double const*, double const*, double const*, int&, double*, int) (in /media/sf_E_DRIVE/software/qpDUNES-dev/build/linux/bin/example3_affine_mpc)
==26416==    by 0x42F689: qpOASES::QProblem::solveRegularisedQP(double const*, double const*, double const*, double const*, double const*, int&, double*, int) (in /media/sf_E_DRIVE/software/qpDUNES-dev/build/linux/bin/example3_affine_mpc)
==26416==    by 0x430A70: qpOASES::QProblem::hotstart(double const*, double const*, double const*, double const*, double const*, int&, double*) (in /media/sf_E_DRIVE/software/qpDUNES-dev/build/linux/bin/example3_affine_mpc)
==26416==    by 0x4328F4: qpOASES::QProblem::solveInitialQP(double const*, double const*, qpOASES::Bounds const*, qpOASES::Constraints const*, int&, double*) (in /media/sf_E_DRIVE/software/qpDUNES-dev/build/linux/bin/example3_affine_mpc)
==26416==    by 0x418DD7: qpOASES_setup (in /media/sf_E_DRIVE/software/qpDUNES-dev/build/linux/bin/example3_affine_mpc)
==26416==    by 0x40FBCD: qpDUNES_setupAllLocalQPs (setup_qp.c:1177)
==26416==    by 0x417D3C: mpcDUNES_initLtv (setup_mpc.c:772)
==26416==    by 0x40DE7C: main (example3_affine_mpc.c:247)

And there are TONS (1227, to be exact) of "Conditional jump or move depends on uninitialised value(s)" errors referring to qpOASES as well as qpDUNES code.