memchecker: per RFC, use calloc for OBJ_NEW
With --enable-memchecker builds, use calloc(3) for OBJ_NEW instead of malloc(3). This cuts down on a lot of valgrind/memory checker false positive output. Also make a minor change in the valgrind configure.m4; have it assign 0xf to a char. The prior assignment (of 0xff) was warning about an overflow. This didn't really matter, but we might as well make the test not have a gratuitious warning in it.
Этот коммит содержится в:
родитель
86f1d5af3e
Коммит
a422d893b8
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2007-2014 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -464,7 +464,11 @@ static inline opal_object_t *opal_obj_new(opal_class_t * cls)
|
||||
opal_object_t *object;
|
||||
assert(cls->cls_sizeof >= sizeof(opal_object_t));
|
||||
|
||||
#if OPAL_WANT_MEMCHECKER
|
||||
object = (opal_object_t *) calloc(1, cls->cls_sizeof);
|
||||
#else
|
||||
object = (opal_object_t *) malloc(cls->cls_sizeof);
|
||||
#endif
|
||||
if (0 == cls->cls_initialized) {
|
||||
opal_class_initialize(cls);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
# University of Stuttgart. All rights reserved.
|
||||
# Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved.
|
||||
# Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
@ -45,7 +45,7 @@ AC_DEFUN([MCA_opal_memchecker_valgrind_CONFIG],[
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include "valgrind/memcheck.h"
|
||||
]],
|
||||
[[char buffer = 0xff;
|
||||
[[char buffer = 0x0f;
|
||||
VALGRIND_CHECK_MEM_IS_ADDRESSABLE(&buffer, sizeof(buffer));]])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
opal_memchecker_valgrind_happy=yes],
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user