Hi,

In PetscFVLeastSquaresPseudoInverseSVD_Static, there is
  Brhs = work;
  maxmn = PetscMax(m,n);
  for (j=0; j<maxmn; j++) {
    for (i=0; i<maxmn; i++) Brhs[i + j*maxmn] = 1.0*(i == j);
  }
where on the calling function, PetscFVComputeGradient_LeastSquares, we set the arguments m <= numFaces, n <= dim and work <= ls->work. The size of the work array is computed in PetscFVLeastSquaresSetMaxFaces_LS as:
  ls->maxFaces = maxFaces;
  m       = ls->maxFaces;
  n       = dim;
  nrhs    = ls->maxFaces;
  minwork = 3*PetscMin(m,n) + PetscMax(2*PetscMin(m,n), PetscMax(PetscMax(m,n), nrhs)); /* required by LAPACK */
  ls->workSize = 5*minwork; /* We can afford to be extra generous */

In my example, the used size (maxmn * maxmn) is 81, and the actual size (ls->workSize) is 75, and therefore valgrind complains.
Is it because I am missing something, or is it a bug ?

Thanks

Pierre Seize

Reply via email to