diff options
author | bergner <bergner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-01-17 03:21:36 +0000 |
---|---|---|
committer | bergner <bergner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-01-17 03:21:36 +0000 |
commit | 2379ccd9a1047577813fde9a396274559a2c7426 (patch) | |
tree | 966e88afff3c3966960437c877988df8a77b722d /gcc/sparseset.c | |
parent | a2060dc39c7ed47658cc4f6ccca2351917b8f14e (diff) | |
download | gcc-2379ccd9a1047577813fde9a396274559a2c7426.tar.gz |
PR rtl-optimization/33796
* sparseset.c (sparseset_alloc): Use xcalloc rather than xmalloc.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131589 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sparseset.c')
-rw-r--r-- | gcc/sparseset.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/sparseset.c b/gcc/sparseset.c index f556c4dc05c..c8a9a301b59 100644 --- a/gcc/sparseset.c +++ b/gcc/sparseset.c @@ -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; |