X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fsparseset.c;h=823919a886e49fd62f48bdd362dd6b1554a13a3f;hb=9d33046c199ad03cc0ba1210be7bcfbbcb136254;hp=8d7cd9373bdd6bc384d6498e854bb56565555d5a;hpb=981db194768f6990aef28c6ea50b2f37012dd92d;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/sparseset.c b/gcc/sparseset.c index 8d7cd9373bd..823919a886e 100644 --- a/gcc/sparseset.c +++ b/gcc/sparseset.c @@ -1,5 +1,5 @@ /* SparseSet implementation. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2008 Free Software Foundation, Inc. Contributed by Peter Bergner This file is part of GCC. @@ -18,10 +18,10 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see . */ -#include "libiberty.h" +#include "config.h" +#include "system.h" #include "sparseset.h" - /* Allocate and clear a n_elms SparseSet. */ sparseset @@ -30,7 +30,12 @@ sparseset_alloc (SPARSESET_ELT_TYPE n_elms) unsigned int n_bytes = sizeof (struct sparseset_def) + ((n_elms - 1) * 2 * sizeof (SPARSESET_ELT_TYPE)); - sparseset set = (sparseset) xmalloc (n_bytes); + /* We use xcalloc rather than xmalloc to silence some valgrind uninitialized + read errors when accessing set->sparse[n] when "n" is not, and never has + been, in the set. These uninitialized reads are expected, by design and + harmless. If this turns into a performance problem due to some future + additional users of sparseset, we can revisit this decision. */ + sparseset set = (sparseset) xcalloc (1, n_bytes); set->dense = &(set->elms[0]); set->sparse = &(set->elms[n_elms]); set->size = n_elms;