summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzimmerma <zimmerma@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2011-09-26 15:14:59 +0000
committerzimmerma <zimmerma@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2011-09-26 15:14:59 +0000
commit9a13dfbc7937765c772a67f949e1cfa3e7e594cc (patch)
tree2852b11cdcb84cb9900737a38109782882d73f20
parent6ef17b63a5488ec414c92d6c490f4a445c617d9b (diff)
downloadmpc-9a13dfbc7937765c772a67f949e1cfa3e7e594cc.tar.gz
[tests/memory.c] added debug test to isolate a bug on x86_64-darwin
(see http://hydra.nixos.org/build/1406145 and http://hydra.nixos.org/build/1405013). Apparently the addresses reported by tests_free() are deterministic. git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@1096 211d60ee-9f03-0410-a15a-8952a2c7a4e4
-rw-r--r--tests/memory.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/memory.c b/tests/memory.c
index d4f8cf4..0dd2dfc 100644
--- a/tests/memory.c
+++ b/tests/memory.c
@@ -27,6 +27,8 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include <limits.h>
#include "gmp.h"
+#define TEST_MEMORY 0x1002001D0
+
#define __gmp_default_allocate malloc
#define __gmp_default_reallocate(p,old,new) realloc(p,new)
#define __gmp_default_free(p,size) free(p)
@@ -90,6 +92,11 @@ tests_allocate (size_t size)
h->size = size;
h->ptr = __gmp_default_allocate (size);
+#ifdef TEST_MEMORY
+ if (h->ptr == (void*) TEST_MEMORY)
+ fprintf (stderr, "tests_allocate: allocated %zu at 0x%lX\n",
+ size, (unsigned long) h->ptr);
+#endif
return h->ptr;
}
@@ -126,6 +133,11 @@ tests_reallocate (void *ptr, size_t old_size, size_t new_size)
h->size = new_size;
h->ptr = __gmp_default_reallocate (ptr, old_size, new_size);
+#ifdef TEST_MEMORY
+ if (h->ptr == (void*) TEST_MEMORY)
+ fprintf (stderr, "tests_reallocate: reallocated from %zu to %zu at 0x%lX\n",
+ old_size, new_size, (unsigned long) h->ptr);
+#endif
return h->ptr;
}