Workaround for MemorySanitizer
authorRoland Schulz <roland@utk.edu>
Fri, 16 May 2014 20:23:11 +0000 (16:23 -0400)
committerRoland Schulz <roland@utk.edu>
Tue, 27 Jan 2015 09:16:18 +0000 (04:16 -0500)
MSan has false positives in qsort (Issue 54) and getlogin_r (83).

Change-Id: Ia63e918b59570e8dfb03222174bf83da24c6e219

src/gromacs/gmxlib/readinp.c
src/gromacs/utility/sysinfo.cpp

index 10a2c7cc366e2932d179af5824894e3de7b2d494..ccc6ccea2b1707b361598fb73d9404f8668eaf8c 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -49,6 +49,7 @@
 #include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
+#include "gromacs/utility/qsort_threadsafe.h"
 #include "gromacs/utility/smalloc.h"
 
 t_inpfile *read_inpfile(const char *fn, int *ninp,
@@ -238,7 +239,7 @@ static void sort_inp(int ninp, t_inpfile inp[])
             inp[i].count = mm++;
         }
     }
-    qsort(inp, ninp, (size_t)sizeof(inp[0]), inp_comp);
+    gmx_qsort(inp, ninp, (size_t)sizeof(inp[0]), inp_comp);
 }
 
 void write_inpfile(const char *fn, int ninp, t_inpfile inp[], gmx_bool bHaltOnUnknown,
index cf7b6693ae25a073b586d89edf79ca62e379ea39..0166582298add50f83225b48d3d8433d9555bb7e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2014, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -121,7 +121,7 @@ int gmx_getusername(char *buf, size_t len)
     {
         return 0;
     }
-#elif defined(HAVE_UNISTD_H)
+#elif defined(HAVE_UNISTD_H) && !__has_feature(memory_sanitizer) //MSAN Issue 83
     if (!getlogin_r(buf, len))
     {
         buf[len-1] = '\0';