diff options
author | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-08-18 13:44:00 +0000 |
---|---|---|
committer | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-08-18 13:44:00 +0000 |
commit | a353bc755478812e3d659452af267ee84c0adc05 (patch) | |
tree | 980b6b631fae3d1c10abb0b3a6d5cc8cc56d40b1 /gcc/sparseset.c | |
parent | 8080ed934a1c063704dfd4d99111862de58f806f (diff) | |
download | gcc-a353bc755478812e3d659452af267ee84c0adc05.tar.gz |
* sparseset.c (sparseset_alloc): Use non-clearing allocation. Tell
valgrind not to worry about reading from unitialized memory.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190503 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sparseset.c')
-rw-r--r-- | gcc/sparseset.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/sparseset.c b/gcc/sparseset.c index 823919a886e..35a2c3e1a34 100644 --- a/gcc/sparseset.c +++ b/gcc/sparseset.c @@ -30,12 +30,14 @@ sparseset_alloc (SPARSESET_ELT_TYPE n_elms) unsigned int n_bytes = sizeof (struct sparseset_def) + ((n_elms - 1) * 2 * sizeof (SPARSESET_ELT_TYPE)); - /* We use xcalloc rather than xmalloc to silence some valgrind uninitialized + sparseset set = XNEWVAR(struct sparseset_def, n_bytes); + + /* Mark the sparseset as defined 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); + harmless. */ + VALGRIND_DISCARD (VALGRIND_MAKE_MEM_DEFINED (set, n_bytes)); + set->dense = &(set->elms[0]); set->sparse = &(set->elms[n_elms]); set->size = n_elms; |