From: Roland Schulz Date: Fri, 16 May 2014 20:23:11 +0000 (-0400) Subject: Workaround for MemorySanitizer X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=4c5c666f9849ab01ca50459185edf3d530b61fb2;p=alexxy%2Fgromacs.git Workaround for MemorySanitizer MSan has false positives in qsort (Issue 54) and getlogin_r (83). Change-Id: Ia63e918b59570e8dfb03222174bf83da24c6e219 --- diff --git a/src/gromacs/gmxlib/readinp.c b/src/gromacs/gmxlib/readinp.c index 10a2c7cc36..ccc6ccea2b 100644 --- a/src/gromacs/gmxlib/readinp.c +++ b/src/gromacs/gmxlib/readinp.c @@ -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, diff --git a/src/gromacs/utility/sysinfo.cpp b/src/gromacs/utility/sysinfo.cpp index cf7b6693ae..0166582298 100644 --- a/src/gromacs/utility/sysinfo.cpp +++ b/src/gromacs/utility/sysinfo.cpp @@ -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';