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;
}