summaryrefslogtreecommitdiffstats
path: root/gcc/alloc-pool.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-23 22:01:55 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-23 22:01:55 +0000
commit992f5b1b7c27a456b761adc2075dcb5066a18c98 (patch)
treed23a6c8fc97e75845e3593b4ce953b6498443bc3 /gcc/alloc-pool.c
parent124ac4e4e3be031b5d9e0d9c855684053af1bf22 (diff)
downloadppe42-gcc-992f5b1b7c27a456b761adc2075dcb5066a18c98.tar.gz
ppe42-gcc-992f5b1b7c27a456b761adc2075dcb5066a18c98.zip
* alloc-pool.c (align_four): Kill.
(create_alloc_pool): Align size to eight. (free_alloc_pool, free_pool): Invalidate deallocated data. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@76456 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/alloc-pool.c')
-rw-r--r--gcc/alloc-pool.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/alloc-pool.c b/gcc/alloc-pool.c
index c21cfe4c707..bdcd42fd139 100644
--- a/gcc/alloc-pool.c
+++ b/gcc/alloc-pool.c
@@ -34,7 +34,6 @@ extern void fancy_abort (const char *, int, const char *)
ATTRIBUTE_NORETURN;
#define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
-#define align_four(x) (((x+3) >> 2) << 2)
#define align_eight(x) (((x+7) >> 3) << 3)
/* The internal allocation object. */
@@ -90,7 +89,7 @@ create_alloc_pool (const char *name, size_t size, size_t num)
size = sizeof (alloc_pool_list);
/* Now align the size to a multiple of 4. */
- size = align_four (size);
+ size = align_eight (size);
#ifdef ENABLE_CHECKING
/* Add the aligned size of ID. */
@@ -154,6 +153,9 @@ free_alloc_pool (alloc_pool pool)
}
/* Lastly, free the pool and the name. */
free (pool->name);
+#ifdef ENABLE_CHECKING
+ memset (pool, 0xaf, sizeof (*pool));
+#endif
free (pool);
}
@@ -225,6 +227,8 @@ pool_free (alloc_pool pool, void *ptr)
if (!ptr)
abort ();
+ memset (ptr, 0xaf, pool->elt_size - offsetof (allocation_object, u.data));
+
/* Check whether the PTR was allocated from POOL. */
if (pool->id != ALLOCATION_OBJECT_PTR_FROM_USER_PTR (ptr)->id)
abort ();
OpenPOWER on IntegriCloud