Thread: Conditional jump or move depends on uninitialized values : valgrind message

  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    16

    Conditional jump or move depends on uninitialized values : valgrind message

    Hi,
    I am calling the following function in my code. When I run th executable with valgrind, I get the following message :"Conditional jump or move depends upon uninitialized value".
    I get this message for all fortran functions used in the code(dgetri_,dgetrf_ etc.). I also get this warning for the exp() function. Can anybody tell me where I am going wrong. BTW the function always returns correct values even if i run it for 1000 times.
    Code:
    double getlikelHood(double *r,double *sigtmp)
    {
       double *n;
       int i,j;
       double lwkopt;
       int ctr;
       int dim = DIMENSION;
       double *work;
       double alpha = 1;
       double beta = 0;
       double *y,*sigma;
       char trans = 'N';
       double y1;
       double result;
       double detVal,retVal;
       int *iipiv,iinfo,wwork,iinc,mmone,lwork,*ipiv,size;
    
       y        = (double*)malloc(DIMENSION*sizeof(double));
       sigma = (double*)malloc(DIMENSION*DIMENSION*sizeof(double));
       n        = (double*)malloc(DIMENSION*DIMENSION*sizeof(double));
       mmone  = -1;
       iinc   = 1;
    
       for(i = 0;i<DIMENSION;i++)
       {
          for(j = 0;j<DIMENSION;j++)
          {
             *(sigma+i*DIMENSION+j) = *(sigtmp+i*DIMENSION+j);
             *(n+i*DIMENSION+j) = *(sigtmp+i*DIMENSION+j);
          }
       }
    
       detVal=0;
       detVal=deter(n,DIMENSION);
       
       ipiv  = (int *)malloc(dim*dim*sizeof(int));
       size  = DIMENSION;
       iinfo = 1;
       dgetri_(&dim,n,&dim,ipiv,&lwkopt,&mmone,&iinfo);
       lwork = (int)lwkopt;
       work  = (double*)malloc(lwork*lwork*sizeof(double));
       dgetrf_(&dim,&dim,sigma,&size,ipiv,&iinfo);
       dgetri_(&dim,sigma,&dim,ipiv,work,&lwork,&iinfo);
      
       dgemv_(&trans,&size,&size,&alpha,sigma,&size,r,&iinc,&beta,y,&iinc);
       
       result = -0.5*ddot_(&size,y,&iinc,r,&iinc);
       
       retVal  = exp(result)/sqrt(4*pi*pi*fabs(detVal));
       free(y);
       free(n);
       free(work);
       free(sigma);
       free(ipiv);
       return retVal;
    }

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    The valgrind log would have helped...
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Dec 2010
    Posts
    16
    The file is attached with the message. I am also posting the log, thought it is very large. You can ignore the message correponding to "chckdgnl". thta part is commented.:-


    ==11770== Memcheck, a memory error detector
    ==11770== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
    ==11770== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
    ==11770== Command: ./two.exe
    ==11770== Parent PID: 16871
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x401C49: chckdgnl (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x403379: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x53A22BF: idamax_ (idamax.f:48)
    ==11770== by 0x4075F9: dgetf2_ (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4070BD: dgetrf_ (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4034FE: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x53961CB: dger_ (dger.f:128)
    ==11770== by 0x407754: dgetf2_ (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4070BD: dgetrf_ (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4034FE: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x53961CD: dger_ (dger.f:128)
    ==11770== by 0x407754: dgetf2_ (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4070BD: dgetrf_ (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4034FE: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x407622: dgetf2_ (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4070BD: dgetrf_ (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4034FE: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x407624: dgetf2_ (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4070BD: dgetrf_ (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4034FE: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x4E3DE04: dtrtri_ (dtrtri.f:111)
    ==11770== by 0x4D6DDA8: dgetri_ (dgetri.f:113)
    ==11770== by 0x40351B: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x4E3DE06: dtrtri_ (dtrtri.f:111)
    ==11770== by 0x4D6DDA8: dgetri_ (dgetri.f:113)
    ==11770== by 0x40351B: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x53A0287: dtrmv_ (dtrmv.f:168)
    ==11770== by 0x4E3DA34: dtrti2_ (dtrti2.f:117)
    ==11770== by 0x4E3E1A8: dtrtri_ (dtrtri.f:123)
    ==11770== by 0x4D6DDA8: dgetri_ (dgetri.f:113)
    ==11770== by 0x40351B: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x53A0289: dtrmv_ (dtrmv.f:168)
    ==11770== by 0x4E3DA34: dtrti2_ (dtrti2.f:117)
    ==11770== by 0x4E3E1A8: dtrtri_ (dtrtri.f:123)
    ==11770== by 0x4D6DDA8: dgetri_ (dgetri.f:113)
    ==11770== by 0x40351B: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x5395F81: dgemv_ (dgemv.f:208)
    ==11770== by 0x4D6E433: dgetri_ (dgetri.f:148)
    ==11770== by 0x40351B: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x5395F83: dgemv_ (dgemv.f:208)
    ==11770== by 0x4D6E433: dgetri_ (dgetri.f:148)
    ==11770== by 0x40351B: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x5395F81: dgemv_ (dgemv.f:208)
    ==11770== by 0x4035C0: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x5395F83: dgemv_ (dgemv.f:208)
    ==11770== by 0x4035C0: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x343460D6BD: __ieee754_exp (in /lib64/libm-2.5.so)
    ==11770== by 0x3434622FA3: exp (in /lib64/libm-2.5.so)
    ==11770== by 0x4035E3: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x343460D81E: __ieee754_exp (in /lib64/libm-2.5.so)
    ==11770== by 0x3434622FA3: exp (in /lib64/libm-2.5.so)
    ==11770== by 0x4035E3: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x343460D82A: __ieee754_exp (in /lib64/libm-2.5.so)
    ==11770== by 0x3434622FA3: exp (in /lib64/libm-2.5.so)
    ==11770== by 0x4035E3: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x343460DA26: __ieee754_exp (in /lib64/libm-2.5.so)
    ==11770== by 0x3434622FA3: exp (in /lib64/libm-2.5.so)
    ==11770== by 0x4035E3: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x343460DA30: __ieee754_exp (in /lib64/libm-2.5.so)
    ==11770== by 0x3434622FA3: exp (in /lib64/libm-2.5.so)
    ==11770== by 0x4035E3: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x343460DA38: __ieee754_exp (in /lib64/libm-2.5.so)
    ==11770== by 0x3434622FA3: exp (in /lib64/libm-2.5.so)
    ==11770== by 0x4035E3: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x3434622FD2: exp (in /lib64/libm-2.5.so)
    ==11770== by 0x4035E3: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Use of uninitialised value of size 8
    ==11770== at 0x343460D75D: __ieee754_exp (in /lib64/libm-2.5.so)
    ==11770== by 0x3434622FA3: exp (in /lib64/libm-2.5.so)
    ==11770== by 0x4035E3: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Use of uninitialised value of size 8
    ==11770== at 0x343460D767: __ieee754_exp (in /lib64/libm-2.5.so)
    ==11770== by 0x3434622FA3: exp (in /lib64/libm-2.5.so)
    ==11770== by 0x4035E3: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x343460D7EB: __ieee754_exp (in /lib64/libm-2.5.so)
    ==11770== by 0x3434622FA3: exp (in /lib64/libm-2.5.so)
    ==11770== by 0x4035E3: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x343460D7F1: __ieee754_exp (in /lib64/libm-2.5.so)
    ==11770== by 0x3434622FA3: exp (in /lib64/libm-2.5.so)
    ==11770== by 0x4035E3: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x3434622FE1: exp (in /lib64/libm-2.5.so)
    ==11770== by 0x4035E3: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770== Conditional jump or move depends on uninitialised value(s)
    ==11770== at 0x3434622FEB: exp (in /lib64/libm-2.5.so)
    ==11770== by 0x4035E3: getlikelHood (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770== by 0x4069A8: main (in /ifs/user/kumarvis/u2/Optimization_UKF/two.exe)
    ==11770==
    ==11770==
    ==11770== HEAP SUMMARY:
    ==11770== in use at exit: 0 bytes in 0 blocks
    ==11770== total heap usage: 2,273 allocs, 2,273 frees, 23,688,944 bytes allocated
    ==11770==
    ==11770== All heap blocks were freed -- no leaks are possible
    ==11770==
    ==11770== For counts of detected and suppressed errors, rerun with: -v
    ==11770== Use --track-origins=yes to see where uninitialised values come from
    ==11770== ERROR SUMMARY: 424 errors from 27 contexts (suppressed: 4 from 4)

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Do you have the Fortran code?
    Do you have the ability to change the Fortran code?

    > ==11770== Conditional jump or move depends on uninitialised value(s)
    > ==11770== at 0x53961CB: dger_ (dger.f:128)
    Posting some of the lines around this line (from the start of the function to line 128 would be good).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Dec 2010
    Posts
    16
    No, I cannot change the fortran code. These are standard fortran commands that can be invoked from linux. These functions are used by MATLAB as well, for doing matrix operations. Even I think that the error may be in fortran code. But since they are standard commands, I am not sure about the error [].

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    dgemv - Google Search
    At least you should be able to read the code to see what is going on.

    Or perhaps send a bug report to the maintainers.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 05-23-2010, 07:32 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 05:48 PM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM