From: Roland Schulz Date: Tue, 9 Oct 2018 01:00:54 +0000 (-0700) Subject: Fix MSAN errors X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=2778c81d84de4b61d4a2d63a6233ad2d2619eb77;p=alexxy%2Fgromacs.git Fix MSAN errors Refs #2642 Change-Id: I94a649f5bf0fdcc85a826882efa520776de7740a --- diff --git a/src/gromacs/domdec/domdec.cpp b/src/gromacs/domdec/domdec.cpp index ec57e3ff01..03371c1994 100644 --- a/src/gromacs/domdec/domdec.cpp +++ b/src/gromacs/domdec/domdec.cpp @@ -1767,7 +1767,8 @@ static void make_dd_communicators(const gmx::MDLogger &mdlog, dd->pme_nodeid = -1; } - if (DDMASTER(dd)) + /* We can not use DDMASTER(dd), because dd->masterrank is set later */ + if (MASTER(cr)) { dd->ma = gmx::compat::make_unique(dd->nc, comm->cgs_gl.nr, diff --git a/src/gromacs/mdlib/lincs.cpp b/src/gromacs/mdlib/lincs.cpp index cde84e0002..0e15e5c8ed 100644 --- a/src/gromacs/mdlib/lincs.cpp +++ b/src/gromacs/mdlib/lincs.cpp @@ -2049,6 +2049,7 @@ void set_lincs(const t_idef &idef, /* Ensure we have enough padding for aligned loads for each thread */ if (ncon_tot + li->ntask*simd_width > li->nc_alloc || li->nc_alloc == 0) { + int old_alloc = li->nc_alloc; li->nc_alloc = over_alloc_dd(ncon_tot + li->ntask*simd_width); srenew(li->con_index, li->nc_alloc); resize_real_aligned(&li->bllen0, li->nc_alloc); @@ -2059,6 +2060,11 @@ void set_lincs(const t_idef &idef, srenew(li->blnr, li->nc_alloc + 1); resize_real_aligned(&li->bllen, li->nc_alloc); srenew(li->tmpv, li->nc_alloc); + /* Need to clear the SIMD padding */ + for (int i = old_alloc; i < li->nc_alloc; i++) + { + clear_rvec(li->tmpv[i]); + } if (DOMAINDECOMP(cr)) { srenew(li->nlocat, li->nc_alloc); diff --git a/src/gromacs/mdrun/minimize.cpp b/src/gromacs/mdrun/minimize.cpp index d2a6a88e24..e8df3efd2a 100644 --- a/src/gromacs/mdrun/minimize.cpp +++ b/src/gromacs/mdrun/minimize.cpp @@ -1159,7 +1159,7 @@ Integrator::do_cg() if (MASTER(cr)) { /* Copy stuff to the energy bin for easy printing etc. */ - matrix nullBox; + matrix nullBox = {}; upd_mdebin(mdebin, FALSE, FALSE, static_cast(step), mdatoms->tmass, enerd, nullptr, nullptr, nullptr, nullBox, nullptr, nullptr, vir, pres, nullptr, mu_tot, constr); @@ -1583,7 +1583,7 @@ Integrator::do_cg() fflush(stderr); } /* Store the new (lower) energies */ - matrix nullBox; + matrix nullBox = {}; upd_mdebin(mdebin, FALSE, FALSE, static_cast(step), mdatoms->tmass, enerd, nullptr, nullptr, nullptr, nullBox, nullptr, nullptr, vir, pres, nullptr, mu_tot, constr); @@ -1830,7 +1830,7 @@ Integrator::do_lbfgs() if (MASTER(cr)) { /* Copy stuff to the energy bin for easy printing etc. */ - matrix nullBox; + matrix nullBox = {}; upd_mdebin(mdebin, FALSE, FALSE, static_cast(step), mdatoms->tmass, enerd, nullptr, nullptr, nullptr, nullBox, nullptr, nullptr, vir, pres, nullptr, mu_tot, constr); @@ -2317,7 +2317,7 @@ Integrator::do_lbfgs() fflush(stderr); } /* Store the new (lower) energies */ - matrix nullBox; + matrix nullBox = {}; upd_mdebin(mdebin, FALSE, FALSE, static_cast(step), mdatoms->tmass, enerd, nullptr, nullptr, nullptr, nullBox, nullptr, nullptr, vir, pres, nullptr, mu_tot, constr); @@ -2534,7 +2534,7 @@ Integrator::do_steep() if ( (count == 0) || (s_try->epot < s_min->epot) ) { /* Store the new (lower) energies */ - matrix nullBox; + matrix nullBox = {}; upd_mdebin(mdebin, FALSE, FALSE, static_cast(count), mdatoms->tmass, enerd, nullptr, nullptr, nullptr, nullBox, nullptr, nullptr, vir, pres, nullptr, mu_tot, constr); diff --git a/src/testutils/testinit.cpp b/src/testutils/testinit.cpp index cf3a108ae8..ed71926fff 100644 --- a/src/testutils/testinit.cpp +++ b/src/testutils/testinit.cpp @@ -161,7 +161,9 @@ std::unique_ptr g_testContext; void initTestUtils(const char *dataPath, const char *tempPath, bool usesMpi, bool usesHardwareDetection, int *argc, char ***argv) { -#ifndef NDEBUG +#if !defined NDEBUG && \ + !((defined __clang__ || (defined(__GNUC__) && !defined(__ICC) && __GNUC__ == 7)) \ + && defined __OPTIMIZE__) gmx_feenableexcept(); #endif const CommandLineProgramContext &context = initForCommandLine(argc, argv);