Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean MSAN warnings #131

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/matrices/blasglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ void blasglue_herk(char uplo, char trans, int n, int k,

int lapackglue_potrf(char uplo, int n, scalar *A, int fdA)
{
int info;
int info = 0;

uplo = uplo == 'U' ? 'L' : 'U';

Expand All @@ -259,7 +259,7 @@ int lapackglue_potrf(char uplo, int n, scalar *A, int fdA)

int lapackglue_potri(char uplo, int n, scalar *A, int fdA)
{
int info;
int info = 0;

uplo = uplo == 'U' ? 'L' : 'U';

Expand All @@ -272,7 +272,7 @@ int lapackglue_potri(char uplo, int n, scalar *A, int fdA)
int lapackglue_hetrf(char uplo, int n, scalar *A, int fdA,
int *ipiv, scalar *work, int lwork)
{
int info;
int info = 0;

uplo = uplo == 'U' ? 'L' : 'U';

Expand All @@ -289,7 +289,7 @@ int lapackglue_hetrf(char uplo, int n, scalar *A, int fdA,
int lapackglue_hetri(char uplo, int n, scalar *A, int fdA,
int *ipiv, scalar *work)
{
int info;
int info = 0;

uplo = uplo == 'U' ? 'L' : 'U';

Expand All @@ -306,7 +306,7 @@ int lapackglue_hetri(char uplo, int n, scalar *A, int fdA,
void lapackglue_heev(char jobz, char uplo, int n, scalar *A, int fdA,
real *w, scalar *work, int lwork, real *rwork)
{
int info;
int info = 0;

uplo = uplo == 'U' ? 'L' : 'U';

Expand All @@ -326,7 +326,7 @@ void lapackglue_geev(char jobvl, char jobvr, int n,
scalar *VL, int fdVL, scalar *VR, int fdVR,
scalar *work, int lwork, real *rwork)
{
int info;
int info = 0;

#ifdef SCALAR_COMPLEX
F(geev,GEEV) (&jobvl, &jobvr, &n, A, &fdA, w, VL, &fdVL, VR, &fdVR,
Expand All @@ -351,7 +351,7 @@ void lapackglue_hegv(int itype, char jobz, char uplo, int n,
scalar *A, int fdA, scalar *B, int fdB,
real *w, scalar *work, int lwork, real *rwork)
{
int info;
int info = 0;

uplo = uplo == 'U' ? 'L' : 'U';

Expand All @@ -369,7 +369,7 @@ void lapackglue_hegv(int itype, char jobz, char uplo, int n,
void lapackglue_syev(char jobz, char uplo, int n, real *A, int fdA,
real *w, real *work, int lwork)
{
int info;
int info = 0;

uplo = uplo == 'U' ? 'L' : 'U';

Expand Down
2 changes: 2 additions & 0 deletions src/matrices/sqmatrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "matrices.h"
#include "blasglue.h"
#include <string.h>

/* Simple operations on sqmatrices. Also, some not-so-simple operations,
like inversion and eigenvalue decomposition. */
Expand Down Expand Up @@ -323,6 +324,7 @@ void sqmatrix_sqrt(sqmatrix Usqrt, sqmatrix U, sqmatrix W)
CHECK(Usqrt.p == U.p && U.p == W.p, "matrices not conformant");

CHK_MALLOC(eigenvals, real, U.p);
memset(eigenvals, 0, sizeof(real) * U.p);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be done in sqmatrix_eigensolve, i.e. won't similar warnings come up on other calls to sqmatrix_eigensolve if Msan doesn't understand LAPACK output variables?

Also should have a comment that that this initialization is not actually necessary, but is just to silence Msan.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this is an incomplete solution to silence the MSan based on the unit tests provided from MEEP. It would give additional warnings if other similar functions are hit, e.g. sqmatrix_eigensolve. It is quite hard to find all the MSan warnings without additional testing cases. Now maybe it is not necessary to silence warnings of use-of-uninitialized-value if you think calloc is not a good solution. Please feel free to close this one and the other one if you agree to leave as it is. Thanks.


sqmatrix_eigensolve(U, eigenvals, W);

Expand Down