Keep clang Address Sanitizer happy
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 28 Jan 2014 01:43:21 +0000 (02:43 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Wed, 29 Jan 2014 22:30:29 +0000 (23:30 +0100)
Allocating 15 bytes with the 8-byte aligned memory at offset 8 of
15, would overflow the buffer, which would be fairly likely to
have no effect. But ASan notices this if you run it on AVX hardware,
unlike the Jenkins build which runs on SSE4.1. The good news is
that this fix is enough to make all the existing tests pass under
ASan on AVX.

Change-Id: I61ff11687709e096c70a162d3514227cb243561d

src/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn_outer.h

index b306733a27daa3d23397797266a7ba1e19052c5a..f041a5c9d8cf5d7910da8ea6a160609bf8fd2164 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2009, The GROMACS Development Team
- * Copyright (c) 2012,2013, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014 by the GROMACS development team, led by
  * David van der Spoel, Berk Hess, Erik Lindahl, and including many
  * others, as listed in the AUTHORS file in the top-level source
  * directory and at http://www.gromacs.org.
     gmx_mm_pr  sh_invrc6_S, sh_invrc12_S;
 
     /* cppcheck-suppress unassignedVariable */
-    real       tmpsum_array[15], *tmpsum;
+    real       tmpsum_array[GMX_SIMD_WIDTH_HERE*2], *tmpsum;
 #endif
 #ifdef CALC_SHIFTFORCES
     /* cppcheck-suppress unassignedVariable */
-    real       shf_array[15], *shf;
+    real       shf_array[GMX_SIMD_WIDTH_HERE*2], *shf;
 #endif
 
     int ninner;